blob: a0ff1594f7c42e30d05be819f4c664cc2f6cf367 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001/*
2 * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
3 *
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);
1556 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1557 g_source_unref (skeleton->priv->changed_properties_idle_source);
1558 }
1559 g_mutex_unlock (&skeleton->priv->lock);
1560}
1561
1562static void
1563occ_skeleton_set_property (GObject *object,
1564 guint prop_id,
1565 const GValue *value,
1566 GParamSpec *pspec)
1567{
1568 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001569 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001570 g_mutex_lock (&skeleton->priv->lock);
1571 g_object_freeze_notify (object);
1572 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1573 {
1574 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1575 _occ_schedule_emit_changed (skeleton, _occ_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1576 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1577 g_object_notify_by_pspec (object, pspec);
1578 }
1579 g_mutex_unlock (&skeleton->priv->lock);
1580 g_object_thaw_notify (object);
1581}
1582
1583static void
1584occ_skeleton_init (OccSkeleton *skeleton)
1585{
1586#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1587 skeleton->priv = occ_skeleton_get_instance_private (skeleton);
1588#else
1589 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OCC_SKELETON, OccSkeletonPrivate);
1590#endif
1591
1592 g_mutex_init (&skeleton->priv->lock);
1593 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James2d1ee892015-09-16 23:13:45 -05001594 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -05001595 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
Norman James2d1ee892015-09-16 23:13:45 -05001596 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
1597 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -05001598}
1599
1600static const gchar *
1601occ_skeleton_get_state (Occ *object)
1602{
1603 OccSkeleton *skeleton = OCC_SKELETON (object);
1604 const gchar *value;
1605 g_mutex_lock (&skeleton->priv->lock);
1606 value = g_value_get_string (&(skeleton->priv->properties[0]));
1607 g_mutex_unlock (&skeleton->priv->lock);
1608 return value;
1609}
1610
Norman James2d1ee892015-09-16 23:13:45 -05001611static const gchar *
1612occ_skeleton_get_instance_name (Occ *object)
1613{
1614 OccSkeleton *skeleton = OCC_SKELETON (object);
1615 const gchar *value;
1616 g_mutex_lock (&skeleton->priv->lock);
1617 value = g_value_get_string (&(skeleton->priv->properties[1]));
1618 g_mutex_unlock (&skeleton->priv->lock);
1619 return value;
1620}
1621
Norman James362a80f2015-09-14 14:04:39 -05001622static gint
1623occ_skeleton_get_poll_interval (Occ *object)
1624{
1625 OccSkeleton *skeleton = OCC_SKELETON (object);
1626 gint value;
1627 g_mutex_lock (&skeleton->priv->lock);
Norman James2d1ee892015-09-16 23:13:45 -05001628 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James362a80f2015-09-14 14:04:39 -05001629 g_mutex_unlock (&skeleton->priv->lock);
1630 return value;
1631}
1632
1633static void
1634occ_skeleton_class_init (OccSkeletonClass *klass)
1635{
1636 GObjectClass *gobject_class;
1637 GDBusInterfaceSkeletonClass *skeleton_class;
1638
1639 gobject_class = G_OBJECT_CLASS (klass);
1640 gobject_class->finalize = occ_skeleton_finalize;
1641 gobject_class->get_property = occ_skeleton_get_property;
1642 gobject_class->set_property = occ_skeleton_set_property;
1643 gobject_class->notify = occ_skeleton_notify;
1644
1645
1646 occ_override_properties (gobject_class, 1);
1647
1648 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1649 skeleton_class->get_info = occ_skeleton_dbus_interface_get_info;
1650 skeleton_class->get_properties = occ_skeleton_dbus_interface_get_properties;
1651 skeleton_class->flush = occ_skeleton_dbus_interface_flush;
1652 skeleton_class->get_vtable = occ_skeleton_dbus_interface_get_vtable;
1653
1654#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1655 g_type_class_add_private (klass, sizeof (OccSkeletonPrivate));
1656#endif
1657}
1658
1659static void
1660occ_skeleton_iface_init (OccIface *iface)
1661{
1662 iface->get_state = occ_skeleton_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001663 iface->get_instance_name = occ_skeleton_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001664 iface->get_poll_interval = occ_skeleton_get_poll_interval;
1665}
1666
1667/**
1668 * occ_skeleton_new:
1669 *
1670 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
1671 *
1672 * Returns: (transfer full) (type OccSkeleton): The skeleton object.
1673 */
1674Occ *
1675occ_skeleton_new (void)
1676{
1677 return OCC (g_object_new (TYPE_OCC_SKELETON, NULL));
1678}
1679
1680/* ------------------------------------------------------------------------
1681 * Code for interface org.openbmc.Fan
1682 * ------------------------------------------------------------------------
1683 */
1684
1685/**
1686 * SECTION:Fan
1687 * @title: Fan
1688 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1689 *
1690 * 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.
1691 */
1692
1693/* ---- Introspection data for org.openbmc.Fan ---- */
1694
1695static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1696{
1697 {
1698 -1,
1699 (gchar *) "cooling_zone",
1700 (gchar *) "i",
1701 NULL
1702 },
1703 FALSE
1704};
1705
1706static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1707{
1708 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
1709 NULL
1710};
1711
1712static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1713{
1714 {
1715 -1,
1716 (gchar *) "setCoolingZone",
1717 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1718 NULL,
1719 NULL
1720 },
1721 "handle-set-cooling-zone",
1722 FALSE
1723};
1724
1725static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1726{
1727 {
1728 -1,
1729 (gchar *) "speed",
1730 (gchar *) "i",
1731 NULL
1732 },
1733 FALSE
1734};
1735
1736static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1737{
1738 &_fan_method_info_get_speed_OUT_ARG_speed,
1739 NULL
1740};
1741
1742static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1743{
1744 {
1745 -1,
1746 (gchar *) "getSpeed",
1747 NULL,
1748 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1749 NULL
1750 },
1751 "handle-get-speed",
1752 FALSE
1753};
1754
1755static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1756{
1757 {
1758 -1,
1759 (gchar *) "speed",
1760 (gchar *) "i",
1761 NULL
1762 },
1763 FALSE
1764};
1765
1766static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1767{
1768 &_fan_method_info_set_speed_IN_ARG_speed,
1769 NULL
1770};
1771
1772static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
1773{
1774 {
1775 -1,
1776 (gchar *) "setSpeed",
1777 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
1778 NULL,
1779 NULL
1780 },
1781 "handle-set-speed",
1782 FALSE
1783};
1784
1785static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
1786{
1787 &_fan_method_info_set_cooling_zone,
1788 &_fan_method_info_get_speed,
1789 &_fan_method_info_set_speed,
1790 NULL
1791};
1792
1793static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
1794{
1795 {
1796 -1,
1797 (gchar *) "speed",
1798 (gchar *) "i",
1799 NULL
1800 },
1801 FALSE
1802};
1803
1804static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
1805{
1806 &_fan_signal_info_speed_changed_ARG_speed,
1807 NULL
1808};
1809
1810static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
1811{
1812 {
1813 -1,
1814 (gchar *) "SpeedChanged",
1815 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
1816 NULL
1817 },
1818 "speed-changed"
1819};
1820
1821static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
1822{
1823 {
1824 -1,
1825 (gchar *) "TachError",
1826 NULL,
1827 NULL
1828 },
1829 "tach-error"
1830};
1831
1832static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
1833{
1834 &_fan_signal_info_speed_changed,
1835 &_fan_signal_info_tach_error,
1836 NULL
1837};
1838
1839static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
1840{
1841 {
1842 -1,
1843 (gchar *) "speed",
1844 (gchar *) "i",
1845 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1846 NULL
1847 },
1848 "speed",
1849 FALSE
1850};
1851
1852static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
1853{
1854 {
1855 -1,
1856 (gchar *) "cooling_zone",
1857 (gchar *) "i",
1858 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1859 NULL
1860 },
1861 "cooling-zone",
1862 FALSE
1863};
1864
1865static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
1866{
1867 {
1868 -1,
1869 (gchar *) "pwm_num",
1870 (gchar *) "i",
1871 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1872 NULL
1873 },
1874 "pwm-num",
1875 FALSE
1876};
1877
1878static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
1879{
1880 &_fan_property_info_speed,
1881 &_fan_property_info_cooling_zone,
1882 &_fan_property_info_pwm_num,
1883 NULL
1884};
1885
1886static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
1887{
1888 {
1889 -1,
1890 (gchar *) "org.openbmc.Fan",
1891 (GDBusMethodInfo **) &_fan_method_info_pointers,
1892 (GDBusSignalInfo **) &_fan_signal_info_pointers,
1893 (GDBusPropertyInfo **) &_fan_property_info_pointers,
1894 NULL
1895 },
1896 "fan",
1897};
1898
1899
1900/**
1901 * fan_interface_info:
1902 *
1903 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
1904 *
1905 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1906 */
1907GDBusInterfaceInfo *
1908fan_interface_info (void)
1909{
1910 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
1911}
1912
1913/**
1914 * fan_override_properties:
1915 * @klass: The class structure for a #GObject<!-- -->-derived class.
1916 * @property_id_begin: The property id to assign to the first overridden property.
1917 *
1918 * Overrides all #GObject properties in the #Fan interface for a concrete class.
1919 * The properties are overridden in the order they are defined.
1920 *
1921 * Returns: The last property id.
1922 */
1923guint
1924fan_override_properties (GObjectClass *klass, guint property_id_begin)
1925{
1926 g_object_class_override_property (klass, property_id_begin++, "speed");
1927 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
1928 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
1929 return property_id_begin - 1;
1930}
1931
1932
1933
1934/**
1935 * Fan:
1936 *
1937 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1938 */
1939
1940/**
1941 * FanIface:
1942 * @parent_iface: The parent interface.
1943 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
1944 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
1945 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
1946 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
1947 * @get_pwm_num: Getter for the #Fan:pwm-num property.
1948 * @get_speed: Getter for the #Fan:speed property.
1949 * @speed_changed: Handler for the #Fan::speed-changed signal.
1950 * @tach_error: Handler for the #Fan::tach-error signal.
1951 *
1952 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1953 */
1954
1955typedef FanIface FanInterface;
1956G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
1957
1958static void
1959fan_default_init (FanIface *iface)
1960{
1961 /* GObject signals for incoming D-Bus method calls: */
1962 /**
1963 * Fan::handle-set-cooling-zone:
1964 * @object: A #Fan.
1965 * @invocation: A #GDBusMethodInvocation.
1966 * @arg_cooling_zone: Argument passed by remote caller.
1967 *
1968 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
1969 *
1970 * 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.
1971 *
1972 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1973 */
1974 g_signal_new ("handle-set-cooling-zone",
1975 G_TYPE_FROM_INTERFACE (iface),
1976 G_SIGNAL_RUN_LAST,
1977 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
1978 g_signal_accumulator_true_handled,
1979 NULL,
1980 g_cclosure_marshal_generic,
1981 G_TYPE_BOOLEAN,
1982 2,
1983 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1984
1985 /**
1986 * Fan::handle-get-speed:
1987 * @object: A #Fan.
1988 * @invocation: A #GDBusMethodInvocation.
1989 *
1990 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
1991 *
1992 * 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.
1993 *
1994 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1995 */
1996 g_signal_new ("handle-get-speed",
1997 G_TYPE_FROM_INTERFACE (iface),
1998 G_SIGNAL_RUN_LAST,
1999 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2000 g_signal_accumulator_true_handled,
2001 NULL,
2002 g_cclosure_marshal_generic,
2003 G_TYPE_BOOLEAN,
2004 1,
2005 G_TYPE_DBUS_METHOD_INVOCATION);
2006
2007 /**
2008 * Fan::handle-set-speed:
2009 * @object: A #Fan.
2010 * @invocation: A #GDBusMethodInvocation.
2011 * @arg_speed: Argument passed by remote caller.
2012 *
2013 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2014 *
2015 * 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.
2016 *
2017 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2018 */
2019 g_signal_new ("handle-set-speed",
2020 G_TYPE_FROM_INTERFACE (iface),
2021 G_SIGNAL_RUN_LAST,
2022 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2023 g_signal_accumulator_true_handled,
2024 NULL,
2025 g_cclosure_marshal_generic,
2026 G_TYPE_BOOLEAN,
2027 2,
2028 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2029
2030 /* GObject signals for received D-Bus signals: */
2031 /**
2032 * Fan::speed-changed:
2033 * @object: A #Fan.
2034 * @arg_speed: Argument.
2035 *
2036 * 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.
2037 *
2038 * 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.
2039 */
2040 g_signal_new ("speed-changed",
2041 G_TYPE_FROM_INTERFACE (iface),
2042 G_SIGNAL_RUN_LAST,
2043 G_STRUCT_OFFSET (FanIface, speed_changed),
2044 NULL,
2045 NULL,
2046 g_cclosure_marshal_generic,
2047 G_TYPE_NONE,
2048 1, G_TYPE_INT);
2049
2050 /**
2051 * Fan::tach-error:
2052 * @object: A #Fan.
2053 *
2054 * 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.
2055 *
2056 * 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.
2057 */
2058 g_signal_new ("tach-error",
2059 G_TYPE_FROM_INTERFACE (iface),
2060 G_SIGNAL_RUN_LAST,
2061 G_STRUCT_OFFSET (FanIface, tach_error),
2062 NULL,
2063 NULL,
2064 g_cclosure_marshal_generic,
2065 G_TYPE_NONE,
2066 0);
2067
2068 /* GObject properties for D-Bus properties: */
2069 /**
2070 * Fan:speed:
2071 *
2072 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2073 *
2074 * 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.
2075 */
2076 g_object_interface_install_property (iface,
2077 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2078 /**
2079 * Fan:cooling-zone:
2080 *
2081 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2082 *
2083 * 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.
2084 */
2085 g_object_interface_install_property (iface,
2086 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2087 /**
2088 * Fan:pwm-num:
2089 *
2090 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
2091 *
2092 * 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.
2093 */
2094 g_object_interface_install_property (iface,
2095 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2096}
2097
2098/**
2099 * fan_get_speed: (skip)
2100 * @object: A #Fan.
2101 *
2102 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2103 *
2104 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2105 *
2106 * Returns: The property value.
2107 */
2108gint
2109fan_get_speed (Fan *object)
2110{
2111 return FAN_GET_IFACE (object)->get_speed (object);
2112}
2113
2114/**
2115 * fan_set_speed: (skip)
2116 * @object: A #Fan.
2117 * @value: The value to set.
2118 *
2119 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2120 *
2121 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2122 */
2123void
2124fan_set_speed (Fan *object, gint value)
2125{
2126 g_object_set (G_OBJECT (object), "speed", value, NULL);
2127}
2128
2129/**
2130 * fan_get_cooling_zone: (skip)
2131 * @object: A #Fan.
2132 *
2133 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2134 *
2135 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2136 *
2137 * Returns: The property value.
2138 */
2139gint
2140fan_get_cooling_zone (Fan *object)
2141{
2142 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2143}
2144
2145/**
2146 * fan_set_cooling_zone: (skip)
2147 * @object: A #Fan.
2148 * @value: The value to set.
2149 *
2150 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2151 *
2152 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2153 */
2154void
2155fan_set_cooling_zone (Fan *object, gint value)
2156{
2157 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2158}
2159
2160/**
2161 * fan_get_pwm_num: (skip)
2162 * @object: A #Fan.
2163 *
2164 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2165 *
2166 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2167 *
2168 * Returns: The property value.
2169 */
2170gint
2171fan_get_pwm_num (Fan *object)
2172{
2173 return FAN_GET_IFACE (object)->get_pwm_num (object);
2174}
2175
2176/**
2177 * fan_set_pwm_num: (skip)
2178 * @object: A #Fan.
2179 * @value: The value to set.
2180 *
2181 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2182 *
2183 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2184 */
2185void
2186fan_set_pwm_num (Fan *object, gint value)
2187{
2188 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2189}
2190
2191/**
2192 * fan_emit_speed_changed:
2193 * @object: A #Fan.
2194 * @arg_speed: Argument to pass with the signal.
2195 *
2196 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2197 */
2198void
2199fan_emit_speed_changed (
2200 Fan *object,
2201 gint arg_speed)
2202{
2203 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2204}
2205
2206/**
2207 * fan_emit_tach_error:
2208 * @object: A #Fan.
2209 *
2210 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2211 */
2212void
2213fan_emit_tach_error (
2214 Fan *object)
2215{
2216 g_signal_emit_by_name (object, "tach-error");
2217}
2218
2219/**
2220 * fan_call_set_cooling_zone:
2221 * @proxy: A #FanProxy.
2222 * @arg_cooling_zone: Argument to pass with the method invocation.
2223 * @cancellable: (allow-none): A #GCancellable or %NULL.
2224 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2225 * @user_data: User data to pass to @callback.
2226 *
2227 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2228 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2229 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2230 *
2231 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2232 */
2233void
2234fan_call_set_cooling_zone (
2235 Fan *proxy,
2236 gint arg_cooling_zone,
2237 GCancellable *cancellable,
2238 GAsyncReadyCallback callback,
2239 gpointer user_data)
2240{
2241 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2242 "setCoolingZone",
2243 g_variant_new ("(i)",
2244 arg_cooling_zone),
2245 G_DBUS_CALL_FLAGS_NONE,
2246 -1,
2247 cancellable,
2248 callback,
2249 user_data);
2250}
2251
2252/**
2253 * fan_call_set_cooling_zone_finish:
2254 * @proxy: A #FanProxy.
2255 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2256 * @error: Return location for error or %NULL.
2257 *
2258 * Finishes an operation started with fan_call_set_cooling_zone().
2259 *
2260 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2261 */
2262gboolean
2263fan_call_set_cooling_zone_finish (
2264 Fan *proxy,
2265 GAsyncResult *res,
2266 GError **error)
2267{
2268 GVariant *_ret;
2269 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2270 if (_ret == NULL)
2271 goto _out;
2272 g_variant_get (_ret,
2273 "()");
2274 g_variant_unref (_ret);
2275_out:
2276 return _ret != NULL;
2277}
2278
2279/**
2280 * fan_call_set_cooling_zone_sync:
2281 * @proxy: A #FanProxy.
2282 * @arg_cooling_zone: Argument to pass with the method invocation.
2283 * @cancellable: (allow-none): A #GCancellable or %NULL.
2284 * @error: Return location for error or %NULL.
2285 *
2286 * 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.
2287 *
2288 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2289 *
2290 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2291 */
2292gboolean
2293fan_call_set_cooling_zone_sync (
2294 Fan *proxy,
2295 gint arg_cooling_zone,
2296 GCancellable *cancellable,
2297 GError **error)
2298{
2299 GVariant *_ret;
2300 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2301 "setCoolingZone",
2302 g_variant_new ("(i)",
2303 arg_cooling_zone),
2304 G_DBUS_CALL_FLAGS_NONE,
2305 -1,
2306 cancellable,
2307 error);
2308 if (_ret == NULL)
2309 goto _out;
2310 g_variant_get (_ret,
2311 "()");
2312 g_variant_unref (_ret);
2313_out:
2314 return _ret != NULL;
2315}
2316
2317/**
2318 * fan_call_get_speed:
2319 * @proxy: A #FanProxy.
2320 * @cancellable: (allow-none): A #GCancellable or %NULL.
2321 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2322 * @user_data: User data to pass to @callback.
2323 *
2324 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2325 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2326 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2327 *
2328 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2329 */
2330void
2331fan_call_get_speed (
2332 Fan *proxy,
2333 GCancellable *cancellable,
2334 GAsyncReadyCallback callback,
2335 gpointer user_data)
2336{
2337 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2338 "getSpeed",
2339 g_variant_new ("()"),
2340 G_DBUS_CALL_FLAGS_NONE,
2341 -1,
2342 cancellable,
2343 callback,
2344 user_data);
2345}
2346
2347/**
2348 * fan_call_get_speed_finish:
2349 * @proxy: A #FanProxy.
2350 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2351 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2352 * @error: Return location for error or %NULL.
2353 *
2354 * Finishes an operation started with fan_call_get_speed().
2355 *
2356 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2357 */
2358gboolean
2359fan_call_get_speed_finish (
2360 Fan *proxy,
2361 gint *out_speed,
2362 GAsyncResult *res,
2363 GError **error)
2364{
2365 GVariant *_ret;
2366 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2367 if (_ret == NULL)
2368 goto _out;
2369 g_variant_get (_ret,
2370 "(i)",
2371 out_speed);
2372 g_variant_unref (_ret);
2373_out:
2374 return _ret != NULL;
2375}
2376
2377/**
2378 * fan_call_get_speed_sync:
2379 * @proxy: A #FanProxy.
2380 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2381 * @cancellable: (allow-none): A #GCancellable or %NULL.
2382 * @error: Return location for error or %NULL.
2383 *
2384 * 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.
2385 *
2386 * See fan_call_get_speed() for the asynchronous version of this method.
2387 *
2388 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2389 */
2390gboolean
2391fan_call_get_speed_sync (
2392 Fan *proxy,
2393 gint *out_speed,
2394 GCancellable *cancellable,
2395 GError **error)
2396{
2397 GVariant *_ret;
2398 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2399 "getSpeed",
2400 g_variant_new ("()"),
2401 G_DBUS_CALL_FLAGS_NONE,
2402 -1,
2403 cancellable,
2404 error);
2405 if (_ret == NULL)
2406 goto _out;
2407 g_variant_get (_ret,
2408 "(i)",
2409 out_speed);
2410 g_variant_unref (_ret);
2411_out:
2412 return _ret != NULL;
2413}
2414
2415/**
2416 * fan_call_set_speed:
2417 * @proxy: A #FanProxy.
2418 * @arg_speed: Argument to pass with the method invocation.
2419 * @cancellable: (allow-none): A #GCancellable or %NULL.
2420 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2421 * @user_data: User data to pass to @callback.
2422 *
2423 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2424 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2425 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2426 *
2427 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2428 */
2429void
2430fan_call_set_speed (
2431 Fan *proxy,
2432 gint arg_speed,
2433 GCancellable *cancellable,
2434 GAsyncReadyCallback callback,
2435 gpointer user_data)
2436{
2437 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2438 "setSpeed",
2439 g_variant_new ("(i)",
2440 arg_speed),
2441 G_DBUS_CALL_FLAGS_NONE,
2442 -1,
2443 cancellable,
2444 callback,
2445 user_data);
2446}
2447
2448/**
2449 * fan_call_set_speed_finish:
2450 * @proxy: A #FanProxy.
2451 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2452 * @error: Return location for error or %NULL.
2453 *
2454 * Finishes an operation started with fan_call_set_speed().
2455 *
2456 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2457 */
2458gboolean
2459fan_call_set_speed_finish (
2460 Fan *proxy,
2461 GAsyncResult *res,
2462 GError **error)
2463{
2464 GVariant *_ret;
2465 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2466 if (_ret == NULL)
2467 goto _out;
2468 g_variant_get (_ret,
2469 "()");
2470 g_variant_unref (_ret);
2471_out:
2472 return _ret != NULL;
2473}
2474
2475/**
2476 * fan_call_set_speed_sync:
2477 * @proxy: A #FanProxy.
2478 * @arg_speed: Argument to pass with the method invocation.
2479 * @cancellable: (allow-none): A #GCancellable or %NULL.
2480 * @error: Return location for error or %NULL.
2481 *
2482 * 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.
2483 *
2484 * See fan_call_set_speed() for the asynchronous version of this method.
2485 *
2486 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2487 */
2488gboolean
2489fan_call_set_speed_sync (
2490 Fan *proxy,
2491 gint arg_speed,
2492 GCancellable *cancellable,
2493 GError **error)
2494{
2495 GVariant *_ret;
2496 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2497 "setSpeed",
2498 g_variant_new ("(i)",
2499 arg_speed),
2500 G_DBUS_CALL_FLAGS_NONE,
2501 -1,
2502 cancellable,
2503 error);
2504 if (_ret == NULL)
2505 goto _out;
2506 g_variant_get (_ret,
2507 "()");
2508 g_variant_unref (_ret);
2509_out:
2510 return _ret != NULL;
2511}
2512
2513/**
2514 * fan_complete_set_cooling_zone:
2515 * @object: A #Fan.
2516 * @invocation: (transfer full): A #GDBusMethodInvocation.
2517 *
2518 * 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.
2519 *
2520 * This method will free @invocation, you cannot use it afterwards.
2521 */
2522void
2523fan_complete_set_cooling_zone (
2524 Fan *object,
2525 GDBusMethodInvocation *invocation)
2526{
2527 g_dbus_method_invocation_return_value (invocation,
2528 g_variant_new ("()"));
2529}
2530
2531/**
2532 * fan_complete_get_speed:
2533 * @object: A #Fan.
2534 * @invocation: (transfer full): A #GDBusMethodInvocation.
2535 * @speed: Parameter to return.
2536 *
2537 * 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.
2538 *
2539 * This method will free @invocation, you cannot use it afterwards.
2540 */
2541void
2542fan_complete_get_speed (
2543 Fan *object,
2544 GDBusMethodInvocation *invocation,
2545 gint speed)
2546{
2547 g_dbus_method_invocation_return_value (invocation,
2548 g_variant_new ("(i)",
2549 speed));
2550}
2551
2552/**
2553 * fan_complete_set_speed:
2554 * @object: A #Fan.
2555 * @invocation: (transfer full): A #GDBusMethodInvocation.
2556 *
2557 * 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.
2558 *
2559 * This method will free @invocation, you cannot use it afterwards.
2560 */
2561void
2562fan_complete_set_speed (
2563 Fan *object,
2564 GDBusMethodInvocation *invocation)
2565{
2566 g_dbus_method_invocation_return_value (invocation,
2567 g_variant_new ("()"));
2568}
2569
2570/* ------------------------------------------------------------------------ */
2571
2572/**
2573 * FanProxy:
2574 *
2575 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2576 */
2577
2578/**
2579 * FanProxyClass:
2580 * @parent_class: The parent class.
2581 *
2582 * Class structure for #FanProxy.
2583 */
2584
2585struct _FanProxyPrivate
2586{
2587 GData *qdata;
2588};
2589
2590static void fan_proxy_iface_init (FanIface *iface);
2591
2592#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2593G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2594 G_ADD_PRIVATE (FanProxy)
2595 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2596
2597#else
2598G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2599 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2600
2601#endif
2602static void
2603fan_proxy_finalize (GObject *object)
2604{
2605 FanProxy *proxy = FAN_PROXY (object);
2606 g_datalist_clear (&proxy->priv->qdata);
2607 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2608}
2609
2610static void
2611fan_proxy_get_property (GObject *object,
2612 guint prop_id,
2613 GValue *value,
2614 GParamSpec *pspec G_GNUC_UNUSED)
2615{
2616 const _ExtendedGDBusPropertyInfo *info;
2617 GVariant *variant;
2618 g_assert (prop_id != 0 && prop_id - 1 < 3);
2619 info = _fan_property_info_pointers[prop_id - 1];
2620 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2621 if (info->use_gvariant)
2622 {
2623 g_value_set_variant (value, variant);
2624 }
2625 else
2626 {
2627 if (variant != NULL)
2628 g_dbus_gvariant_to_gvalue (variant, value);
2629 }
2630 if (variant != NULL)
2631 g_variant_unref (variant);
2632}
2633
2634static void
2635fan_proxy_set_property_cb (GDBusProxy *proxy,
2636 GAsyncResult *res,
2637 gpointer user_data)
2638{
2639 const _ExtendedGDBusPropertyInfo *info = user_data;
2640 GError *error;
2641 GVariant *_ret;
2642 error = NULL;
2643 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2644 if (!_ret)
2645 {
2646 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2647 info->parent_struct.name,
2648 error->message, g_quark_to_string (error->domain), error->code);
2649 g_error_free (error);
2650 }
2651 else
2652 {
2653 g_variant_unref (_ret);
2654 }
2655}
2656
2657static void
2658fan_proxy_set_property (GObject *object,
2659 guint prop_id,
2660 const GValue *value,
2661 GParamSpec *pspec G_GNUC_UNUSED)
2662{
2663 const _ExtendedGDBusPropertyInfo *info;
2664 GVariant *variant;
2665 g_assert (prop_id != 0 && prop_id - 1 < 3);
2666 info = _fan_property_info_pointers[prop_id - 1];
2667 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2668 g_dbus_proxy_call (G_DBUS_PROXY (object),
2669 "org.freedesktop.DBus.Properties.Set",
2670 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2671 G_DBUS_CALL_FLAGS_NONE,
2672 -1,
2673 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2674 g_variant_unref (variant);
2675}
2676
2677static void
2678fan_proxy_g_signal (GDBusProxy *proxy,
2679 const gchar *sender_name G_GNUC_UNUSED,
2680 const gchar *signal_name,
2681 GVariant *parameters)
2682{
2683 _ExtendedGDBusSignalInfo *info;
2684 GVariantIter iter;
2685 GVariant *child;
2686 GValue *paramv;
2687 guint num_params;
2688 guint n;
2689 guint signal_id;
2690 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2691 if (info == NULL)
2692 return;
2693 num_params = g_variant_n_children (parameters);
2694 paramv = g_new0 (GValue, num_params + 1);
2695 g_value_init (&paramv[0], TYPE_FAN);
2696 g_value_set_object (&paramv[0], proxy);
2697 g_variant_iter_init (&iter, parameters);
2698 n = 1;
2699 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2700 {
2701 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2702 if (arg_info->use_gvariant)
2703 {
2704 g_value_init (&paramv[n], G_TYPE_VARIANT);
2705 g_value_set_variant (&paramv[n], child);
2706 n++;
2707 }
2708 else
2709 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2710 g_variant_unref (child);
2711 }
2712 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2713 g_signal_emitv (paramv, signal_id, 0, NULL);
2714 for (n = 0; n < num_params + 1; n++)
2715 g_value_unset (&paramv[n]);
2716 g_free (paramv);
2717}
2718
2719static void
2720fan_proxy_g_properties_changed (GDBusProxy *_proxy,
2721 GVariant *changed_properties,
2722 const gchar *const *invalidated_properties)
2723{
2724 FanProxy *proxy = FAN_PROXY (_proxy);
2725 guint n;
2726 const gchar *key;
2727 GVariantIter *iter;
2728 _ExtendedGDBusPropertyInfo *info;
2729 g_variant_get (changed_properties, "a{sv}", &iter);
2730 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2731 {
2732 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
2733 g_datalist_remove_data (&proxy->priv->qdata, key);
2734 if (info != NULL)
2735 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2736 }
2737 g_variant_iter_free (iter);
2738 for (n = 0; invalidated_properties[n] != NULL; n++)
2739 {
2740 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
2741 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2742 if (info != NULL)
2743 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2744 }
2745}
2746
2747static gint
2748fan_proxy_get_speed (Fan *object)
2749{
2750 FanProxy *proxy = FAN_PROXY (object);
2751 GVariant *variant;
2752 gint value = 0;
2753 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
2754 if (variant != NULL)
2755 {
2756 value = g_variant_get_int32 (variant);
2757 g_variant_unref (variant);
2758 }
2759 return value;
2760}
2761
2762static gint
2763fan_proxy_get_cooling_zone (Fan *object)
2764{
2765 FanProxy *proxy = FAN_PROXY (object);
2766 GVariant *variant;
2767 gint value = 0;
2768 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
2769 if (variant != NULL)
2770 {
2771 value = g_variant_get_int32 (variant);
2772 g_variant_unref (variant);
2773 }
2774 return value;
2775}
2776
2777static gint
2778fan_proxy_get_pwm_num (Fan *object)
2779{
2780 FanProxy *proxy = FAN_PROXY (object);
2781 GVariant *variant;
2782 gint value = 0;
2783 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
2784 if (variant != NULL)
2785 {
2786 value = g_variant_get_int32 (variant);
2787 g_variant_unref (variant);
2788 }
2789 return value;
2790}
2791
2792static void
2793fan_proxy_init (FanProxy *proxy)
2794{
2795#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2796 proxy->priv = fan_proxy_get_instance_private (proxy);
2797#else
2798 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
2799#endif
2800
2801 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
2802}
2803
2804static void
2805fan_proxy_class_init (FanProxyClass *klass)
2806{
2807 GObjectClass *gobject_class;
2808 GDBusProxyClass *proxy_class;
2809
2810 gobject_class = G_OBJECT_CLASS (klass);
2811 gobject_class->finalize = fan_proxy_finalize;
2812 gobject_class->get_property = fan_proxy_get_property;
2813 gobject_class->set_property = fan_proxy_set_property;
2814
2815 proxy_class = G_DBUS_PROXY_CLASS (klass);
2816 proxy_class->g_signal = fan_proxy_g_signal;
2817 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
2818
2819 fan_override_properties (gobject_class, 1);
2820
2821#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2822 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
2823#endif
2824}
2825
2826static void
2827fan_proxy_iface_init (FanIface *iface)
2828{
2829 iface->get_speed = fan_proxy_get_speed;
2830 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
2831 iface->get_pwm_num = fan_proxy_get_pwm_num;
2832}
2833
2834/**
2835 * fan_proxy_new:
2836 * @connection: A #GDBusConnection.
2837 * @flags: Flags from the #GDBusProxyFlags enumeration.
2838 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2839 * @object_path: An object path.
2840 * @cancellable: (allow-none): A #GCancellable or %NULL.
2841 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2842 * @user_data: User data to pass to @callback.
2843 *
2844 * 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.
2845 *
2846 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2847 * You can then call fan_proxy_new_finish() to get the result of the operation.
2848 *
2849 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
2850 */
2851void
2852fan_proxy_new (
2853 GDBusConnection *connection,
2854 GDBusProxyFlags flags,
2855 const gchar *name,
2856 const gchar *object_path,
2857 GCancellable *cancellable,
2858 GAsyncReadyCallback callback,
2859 gpointer user_data)
2860{
2861 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);
2862}
2863
2864/**
2865 * fan_proxy_new_finish:
2866 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
2867 * @error: Return location for error or %NULL
2868 *
2869 * Finishes an operation started with fan_proxy_new().
2870 *
2871 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2872 */
2873Fan *
2874fan_proxy_new_finish (
2875 GAsyncResult *res,
2876 GError **error)
2877{
2878 GObject *ret;
2879 GObject *source_object;
2880 source_object = g_async_result_get_source_object (res);
2881 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2882 g_object_unref (source_object);
2883 if (ret != NULL)
2884 return FAN (ret);
2885 else
2886 return NULL;
2887}
2888
2889/**
2890 * fan_proxy_new_sync:
2891 * @connection: A #GDBusConnection.
2892 * @flags: Flags from the #GDBusProxyFlags enumeration.
2893 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2894 * @object_path: An object path.
2895 * @cancellable: (allow-none): A #GCancellable or %NULL.
2896 * @error: Return location for error or %NULL
2897 *
2898 * 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.
2899 *
2900 * The calling thread is blocked until a reply is received.
2901 *
2902 * See fan_proxy_new() for the asynchronous version of this constructor.
2903 *
2904 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2905 */
2906Fan *
2907fan_proxy_new_sync (
2908 GDBusConnection *connection,
2909 GDBusProxyFlags flags,
2910 const gchar *name,
2911 const gchar *object_path,
2912 GCancellable *cancellable,
2913 GError **error)
2914{
2915 GInitable *ret;
2916 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);
2917 if (ret != NULL)
2918 return FAN (ret);
2919 else
2920 return NULL;
2921}
2922
2923
2924/**
2925 * fan_proxy_new_for_bus:
2926 * @bus_type: A #GBusType.
2927 * @flags: Flags from the #GDBusProxyFlags enumeration.
2928 * @name: A bus name (well-known or unique).
2929 * @object_path: An object path.
2930 * @cancellable: (allow-none): A #GCancellable or %NULL.
2931 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2932 * @user_data: User data to pass to @callback.
2933 *
2934 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2935 *
2936 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2937 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
2938 *
2939 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2940 */
2941void
2942fan_proxy_new_for_bus (
2943 GBusType bus_type,
2944 GDBusProxyFlags flags,
2945 const gchar *name,
2946 const gchar *object_path,
2947 GCancellable *cancellable,
2948 GAsyncReadyCallback callback,
2949 gpointer user_data)
2950{
2951 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);
2952}
2953
2954/**
2955 * fan_proxy_new_for_bus_finish:
2956 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
2957 * @error: Return location for error or %NULL
2958 *
2959 * Finishes an operation started with fan_proxy_new_for_bus().
2960 *
2961 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2962 */
2963Fan *
2964fan_proxy_new_for_bus_finish (
2965 GAsyncResult *res,
2966 GError **error)
2967{
2968 GObject *ret;
2969 GObject *source_object;
2970 source_object = g_async_result_get_source_object (res);
2971 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2972 g_object_unref (source_object);
2973 if (ret != NULL)
2974 return FAN (ret);
2975 else
2976 return NULL;
2977}
2978
2979/**
2980 * fan_proxy_new_for_bus_sync:
2981 * @bus_type: A #GBusType.
2982 * @flags: Flags from the #GDBusProxyFlags enumeration.
2983 * @name: A bus name (well-known or unique).
2984 * @object_path: An object path.
2985 * @cancellable: (allow-none): A #GCancellable or %NULL.
2986 * @error: Return location for error or %NULL
2987 *
2988 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2989 *
2990 * The calling thread is blocked until a reply is received.
2991 *
2992 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
2993 *
2994 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2995 */
2996Fan *
2997fan_proxy_new_for_bus_sync (
2998 GBusType bus_type,
2999 GDBusProxyFlags flags,
3000 const gchar *name,
3001 const gchar *object_path,
3002 GCancellable *cancellable,
3003 GError **error)
3004{
3005 GInitable *ret;
3006 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);
3007 if (ret != NULL)
3008 return FAN (ret);
3009 else
3010 return NULL;
3011}
3012
3013
3014/* ------------------------------------------------------------------------ */
3015
3016/**
3017 * FanSkeleton:
3018 *
3019 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3020 */
3021
3022/**
3023 * FanSkeletonClass:
3024 * @parent_class: The parent class.
3025 *
3026 * Class structure for #FanSkeleton.
3027 */
3028
3029struct _FanSkeletonPrivate
3030{
3031 GValue *properties;
3032 GList *changed_properties;
3033 GSource *changed_properties_idle_source;
3034 GMainContext *context;
3035 GMutex lock;
3036};
3037
3038static void
3039_fan_skeleton_handle_method_call (
3040 GDBusConnection *connection G_GNUC_UNUSED,
3041 const gchar *sender G_GNUC_UNUSED,
3042 const gchar *object_path G_GNUC_UNUSED,
3043 const gchar *interface_name,
3044 const gchar *method_name,
3045 GVariant *parameters,
3046 GDBusMethodInvocation *invocation,
3047 gpointer user_data)
3048{
3049 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3050 _ExtendedGDBusMethodInfo *info;
3051 GVariantIter iter;
3052 GVariant *child;
3053 GValue *paramv;
3054 guint num_params;
3055 guint num_extra;
3056 guint n;
3057 guint signal_id;
3058 GValue return_value = G_VALUE_INIT;
3059 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3060 g_assert (info != NULL);
3061 num_params = g_variant_n_children (parameters);
3062 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3063 n = 0;
3064 g_value_init (&paramv[n], TYPE_FAN);
3065 g_value_set_object (&paramv[n++], skeleton);
3066 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3067 g_value_set_object (&paramv[n++], invocation);
3068 if (info->pass_fdlist)
3069 {
3070#ifdef G_OS_UNIX
3071 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3072 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3073#else
3074 g_assert_not_reached ();
3075#endif
3076 }
3077 g_variant_iter_init (&iter, parameters);
3078 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3079 {
3080 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3081 if (arg_info->use_gvariant)
3082 {
3083 g_value_init (&paramv[n], G_TYPE_VARIANT);
3084 g_value_set_variant (&paramv[n], child);
3085 n++;
3086 }
3087 else
3088 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3089 g_variant_unref (child);
3090 }
3091 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3092 g_value_init (&return_value, G_TYPE_BOOLEAN);
3093 g_signal_emitv (paramv, signal_id, 0, &return_value);
3094 if (!g_value_get_boolean (&return_value))
3095 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);
3096 g_value_unset (&return_value);
3097 for (n = 0; n < num_params + num_extra; n++)
3098 g_value_unset (&paramv[n]);
3099 g_free (paramv);
3100}
3101
3102static GVariant *
3103_fan_skeleton_handle_get_property (
3104 GDBusConnection *connection G_GNUC_UNUSED,
3105 const gchar *sender G_GNUC_UNUSED,
3106 const gchar *object_path G_GNUC_UNUSED,
3107 const gchar *interface_name G_GNUC_UNUSED,
3108 const gchar *property_name,
3109 GError **error,
3110 gpointer user_data)
3111{
3112 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3113 GValue value = G_VALUE_INIT;
3114 GParamSpec *pspec;
3115 _ExtendedGDBusPropertyInfo *info;
3116 GVariant *ret;
3117 ret = NULL;
3118 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3119 g_assert (info != NULL);
3120 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3121 if (pspec == NULL)
3122 {
3123 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3124 }
3125 else
3126 {
3127 g_value_init (&value, pspec->value_type);
3128 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3129 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3130 g_value_unset (&value);
3131 }
3132 return ret;
3133}
3134
3135static gboolean
3136_fan_skeleton_handle_set_property (
3137 GDBusConnection *connection G_GNUC_UNUSED,
3138 const gchar *sender G_GNUC_UNUSED,
3139 const gchar *object_path G_GNUC_UNUSED,
3140 const gchar *interface_name G_GNUC_UNUSED,
3141 const gchar *property_name,
3142 GVariant *variant,
3143 GError **error,
3144 gpointer user_data)
3145{
3146 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3147 GValue value = G_VALUE_INIT;
3148 GParamSpec *pspec;
3149 _ExtendedGDBusPropertyInfo *info;
3150 gboolean ret;
3151 ret = FALSE;
3152 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3153 g_assert (info != NULL);
3154 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3155 if (pspec == NULL)
3156 {
3157 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3158 }
3159 else
3160 {
3161 if (info->use_gvariant)
3162 g_value_set_variant (&value, variant);
3163 else
3164 g_dbus_gvariant_to_gvalue (variant, &value);
3165 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3166 g_value_unset (&value);
3167 ret = TRUE;
3168 }
3169 return ret;
3170}
3171
3172static const GDBusInterfaceVTable _fan_skeleton_vtable =
3173{
3174 _fan_skeleton_handle_method_call,
3175 _fan_skeleton_handle_get_property,
3176 _fan_skeleton_handle_set_property,
3177 {NULL}
3178};
3179
3180static GDBusInterfaceInfo *
3181fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3182{
3183 return fan_interface_info ();
3184}
3185
3186static GDBusInterfaceVTable *
3187fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3188{
3189 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3190}
3191
3192static GVariant *
3193fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3194{
3195 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3196
3197 GVariantBuilder builder;
3198 guint n;
3199 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3200 if (_fan_interface_info.parent_struct.properties == NULL)
3201 goto out;
3202 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3203 {
3204 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3205 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3206 {
3207 GVariant *value;
3208 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);
3209 if (value != NULL)
3210 {
3211 g_variant_take_ref (value);
3212 g_variant_builder_add (&builder, "{sv}", info->name, value);
3213 g_variant_unref (value);
3214 }
3215 }
3216 }
3217out:
3218 return g_variant_builder_end (&builder);
3219}
3220
3221static gboolean _fan_emit_changed (gpointer user_data);
3222
3223static void
3224fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3225{
3226 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3227 gboolean emit_changed = FALSE;
3228
3229 g_mutex_lock (&skeleton->priv->lock);
3230 if (skeleton->priv->changed_properties_idle_source != NULL)
3231 {
3232 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3233 skeleton->priv->changed_properties_idle_source = NULL;
3234 emit_changed = TRUE;
3235 }
3236 g_mutex_unlock (&skeleton->priv->lock);
3237
3238 if (emit_changed)
3239 _fan_emit_changed (skeleton);
3240}
3241
3242static void
3243_fan_on_signal_speed_changed (
3244 Fan *object,
3245 gint arg_speed)
3246{
3247 FanSkeleton *skeleton = FAN_SKELETON (object);
3248
3249 GList *connections, *l;
3250 GVariant *signal_variant;
3251 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3252
3253 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3254 arg_speed));
3255 for (l = connections; l != NULL; l = l->next)
3256 {
3257 GDBusConnection *connection = l->data;
3258 g_dbus_connection_emit_signal (connection,
3259 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3260 signal_variant, NULL);
3261 }
3262 g_variant_unref (signal_variant);
3263 g_list_free_full (connections, g_object_unref);
3264}
3265
3266static void
3267_fan_on_signal_tach_error (
3268 Fan *object)
3269{
3270 FanSkeleton *skeleton = FAN_SKELETON (object);
3271
3272 GList *connections, *l;
3273 GVariant *signal_variant;
3274 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3275
3276 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3277 for (l = connections; l != NULL; l = l->next)
3278 {
3279 GDBusConnection *connection = l->data;
3280 g_dbus_connection_emit_signal (connection,
3281 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3282 signal_variant, NULL);
3283 }
3284 g_variant_unref (signal_variant);
3285 g_list_free_full (connections, g_object_unref);
3286}
3287
3288static void fan_skeleton_iface_init (FanIface *iface);
3289#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3290G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3291 G_ADD_PRIVATE (FanSkeleton)
3292 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3293
3294#else
3295G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3296 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3297
3298#endif
3299static void
3300fan_skeleton_finalize (GObject *object)
3301{
3302 FanSkeleton *skeleton = FAN_SKELETON (object);
3303 guint n;
3304 for (n = 0; n < 3; n++)
3305 g_value_unset (&skeleton->priv->properties[n]);
3306 g_free (skeleton->priv->properties);
3307 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3308 if (skeleton->priv->changed_properties_idle_source != NULL)
3309 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3310 g_main_context_unref (skeleton->priv->context);
3311 g_mutex_clear (&skeleton->priv->lock);
3312 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3313}
3314
3315static void
3316fan_skeleton_get_property (GObject *object,
3317 guint prop_id,
3318 GValue *value,
3319 GParamSpec *pspec G_GNUC_UNUSED)
3320{
3321 FanSkeleton *skeleton = FAN_SKELETON (object);
3322 g_assert (prop_id != 0 && prop_id - 1 < 3);
3323 g_mutex_lock (&skeleton->priv->lock);
3324 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3325 g_mutex_unlock (&skeleton->priv->lock);
3326}
3327
3328static gboolean
3329_fan_emit_changed (gpointer user_data)
3330{
3331 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3332 GList *l;
3333 GVariantBuilder builder;
3334 GVariantBuilder invalidated_builder;
3335 guint num_changes;
3336
3337 g_mutex_lock (&skeleton->priv->lock);
3338 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3339 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3340 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3341 {
3342 ChangedProperty *cp = l->data;
3343 GVariant *variant;
3344 const GValue *cur_value;
3345
3346 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3347 if (!_g_value_equal (cur_value, &cp->orig_value))
3348 {
3349 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3350 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3351 g_variant_unref (variant);
3352 num_changes++;
3353 }
3354 }
3355 if (num_changes > 0)
3356 {
3357 GList *connections, *ll;
3358 GVariant *signal_variant;
3359 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3360 &builder, &invalidated_builder));
3361 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3362 for (ll = connections; ll != NULL; ll = ll->next)
3363 {
3364 GDBusConnection *connection = ll->data;
3365
3366 g_dbus_connection_emit_signal (connection,
3367 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3368 "org.freedesktop.DBus.Properties",
3369 "PropertiesChanged",
3370 signal_variant,
3371 NULL);
3372 }
3373 g_variant_unref (signal_variant);
3374 g_list_free_full (connections, g_object_unref);
3375 }
3376 else
3377 {
3378 g_variant_builder_clear (&builder);
3379 g_variant_builder_clear (&invalidated_builder);
3380 }
3381 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3382 skeleton->priv->changed_properties = NULL;
3383 skeleton->priv->changed_properties_idle_source = NULL;
3384 g_mutex_unlock (&skeleton->priv->lock);
3385 return FALSE;
3386}
3387
3388static void
3389_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3390{
3391 ChangedProperty *cp;
3392 GList *l;
3393 cp = NULL;
3394 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3395 {
3396 ChangedProperty *i_cp = l->data;
3397 if (i_cp->info == info)
3398 {
3399 cp = i_cp;
3400 break;
3401 }
3402 }
3403 if (cp == NULL)
3404 {
3405 cp = g_new0 (ChangedProperty, 1);
3406 cp->prop_id = prop_id;
3407 cp->info = info;
3408 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3409 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3410 g_value_copy (orig_value, &cp->orig_value);
3411 }
3412}
3413
3414static void
3415fan_skeleton_notify (GObject *object,
3416 GParamSpec *pspec G_GNUC_UNUSED)
3417{
3418 FanSkeleton *skeleton = FAN_SKELETON (object);
3419 g_mutex_lock (&skeleton->priv->lock);
3420 if (skeleton->priv->changed_properties != NULL &&
3421 skeleton->priv->changed_properties_idle_source == NULL)
3422 {
3423 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3424 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3425 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3426 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3427 g_source_unref (skeleton->priv->changed_properties_idle_source);
3428 }
3429 g_mutex_unlock (&skeleton->priv->lock);
3430}
3431
3432static void
3433fan_skeleton_set_property (GObject *object,
3434 guint prop_id,
3435 const GValue *value,
3436 GParamSpec *pspec)
3437{
3438 FanSkeleton *skeleton = FAN_SKELETON (object);
3439 g_assert (prop_id != 0 && prop_id - 1 < 3);
3440 g_mutex_lock (&skeleton->priv->lock);
3441 g_object_freeze_notify (object);
3442 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3443 {
3444 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3445 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3446 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3447 g_object_notify_by_pspec (object, pspec);
3448 }
3449 g_mutex_unlock (&skeleton->priv->lock);
3450 g_object_thaw_notify (object);
3451}
3452
3453static void
3454fan_skeleton_init (FanSkeleton *skeleton)
3455{
3456#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3457 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3458#else
3459 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3460#endif
3461
3462 g_mutex_init (&skeleton->priv->lock);
3463 skeleton->priv->context = g_main_context_ref_thread_default ();
3464 skeleton->priv->properties = g_new0 (GValue, 3);
3465 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3466 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3467 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3468}
3469
3470static gint
3471fan_skeleton_get_speed (Fan *object)
3472{
3473 FanSkeleton *skeleton = FAN_SKELETON (object);
3474 gint value;
3475 g_mutex_lock (&skeleton->priv->lock);
3476 value = g_value_get_int (&(skeleton->priv->properties[0]));
3477 g_mutex_unlock (&skeleton->priv->lock);
3478 return value;
3479}
3480
3481static gint
3482fan_skeleton_get_cooling_zone (Fan *object)
3483{
3484 FanSkeleton *skeleton = FAN_SKELETON (object);
3485 gint value;
3486 g_mutex_lock (&skeleton->priv->lock);
3487 value = g_value_get_int (&(skeleton->priv->properties[1]));
3488 g_mutex_unlock (&skeleton->priv->lock);
3489 return value;
3490}
3491
3492static gint
3493fan_skeleton_get_pwm_num (Fan *object)
3494{
3495 FanSkeleton *skeleton = FAN_SKELETON (object);
3496 gint value;
3497 g_mutex_lock (&skeleton->priv->lock);
3498 value = g_value_get_int (&(skeleton->priv->properties[2]));
3499 g_mutex_unlock (&skeleton->priv->lock);
3500 return value;
3501}
3502
3503static void
3504fan_skeleton_class_init (FanSkeletonClass *klass)
3505{
3506 GObjectClass *gobject_class;
3507 GDBusInterfaceSkeletonClass *skeleton_class;
3508
3509 gobject_class = G_OBJECT_CLASS (klass);
3510 gobject_class->finalize = fan_skeleton_finalize;
3511 gobject_class->get_property = fan_skeleton_get_property;
3512 gobject_class->set_property = fan_skeleton_set_property;
3513 gobject_class->notify = fan_skeleton_notify;
3514
3515
3516 fan_override_properties (gobject_class, 1);
3517
3518 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3519 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3520 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3521 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3522 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3523
3524#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3525 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3526#endif
3527}
3528
3529static void
3530fan_skeleton_iface_init (FanIface *iface)
3531{
3532 iface->speed_changed = _fan_on_signal_speed_changed;
3533 iface->tach_error = _fan_on_signal_tach_error;
3534 iface->get_speed = fan_skeleton_get_speed;
3535 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3536 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3537}
3538
3539/**
3540 * fan_skeleton_new:
3541 *
3542 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3543 *
3544 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3545 */
3546Fan *
3547fan_skeleton_new (void)
3548{
3549 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3550}
3551
3552/* ------------------------------------------------------------------------
3553 * Code for interface org.openbmc.SensorValue
3554 * ------------------------------------------------------------------------
3555 */
3556
3557/**
3558 * SECTION:SensorValue
3559 * @title: SensorValue
3560 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3561 *
3562 * 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.
3563 */
3564
3565/* ---- Introspection data for org.openbmc.SensorValue ---- */
3566
3567static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3568{
3569 {
3570 -1,
3571 (gchar *) "init",
3572 NULL,
3573 NULL,
3574 NULL
3575 },
3576 "handle-init",
3577 FALSE
3578};
3579
3580static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3581{
3582 {
3583 -1,
3584 (gchar *) "value",
3585 (gchar *) "v",
3586 NULL
3587 },
3588 FALSE
3589};
3590
3591static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3592{
3593 &_sensor_value_method_info_get_value_OUT_ARG_value,
3594 NULL
3595};
3596
3597static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3598{
3599 {
3600 -1,
3601 (gchar *) "getValue",
3602 NULL,
3603 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3604 NULL
3605 },
3606 "handle-get-value",
3607 FALSE
3608};
3609
Norman James19e45912015-10-04 20:19:41 -05003610static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3611{
3612 {
3613 -1,
3614 (gchar *) "value",
3615 (gchar *) "v",
3616 NULL
3617 },
3618 FALSE
3619};
3620
3621static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3622{
3623 &_sensor_value_method_info_set_value_IN_ARG_value,
3624 NULL
3625};
3626
3627static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3628{
3629 {
3630 -1,
3631 (gchar *) "setValue",
3632 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3633 NULL,
3634 NULL
3635 },
3636 "handle-set-value",
3637 FALSE
3638};
3639
Norman James362a80f2015-09-14 14:04:39 -05003640static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3641{
3642 &_sensor_value_method_info_init,
3643 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05003644 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05003645 NULL
3646};
3647
3648static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3649{
3650 {
3651 -1,
3652 (gchar *) "value",
3653 (gchar *) "v",
3654 NULL
3655 },
3656 FALSE
3657};
3658
3659static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3660{
3661 {
3662 -1,
3663 (gchar *) "units",
3664 (gchar *) "s",
3665 NULL
3666 },
3667 FALSE
3668};
3669
3670static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3671{
3672 &_sensor_value_signal_info_changed_ARG_value,
3673 &_sensor_value_signal_info_changed_ARG_units,
3674 NULL
3675};
3676
3677static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3678{
3679 {
3680 -1,
3681 (gchar *) "Changed",
3682 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3683 NULL
3684 },
3685 "changed"
3686};
3687
Norman James32e74e22015-09-15 21:28:06 -05003688static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
3689{
3690 {
3691 -1,
3692 (gchar *) "Error",
3693 NULL,
3694 NULL
3695 },
3696 "error"
3697};
3698
Norman James362a80f2015-09-14 14:04:39 -05003699static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3700{
3701 {
3702 -1,
3703 (gchar *) "bus_name",
3704 (gchar *) "s",
3705 NULL
3706 },
3707 FALSE
3708};
3709
3710static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3711{
3712 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3713 NULL
3714};
3715
3716static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3717{
3718 {
3719 -1,
3720 (gchar *) "Heartbeat",
3721 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3722 NULL
3723 },
3724 "heartbeat"
3725};
3726
3727static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3728{
3729 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05003730 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05003731 &_sensor_value_signal_info_heartbeat,
3732 NULL
3733};
3734
3735static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3736{
3737 {
3738 -1,
3739 (gchar *) "value",
3740 (gchar *) "v",
3741 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3742 NULL
3743 },
3744 "value",
3745 FALSE
3746};
3747
3748static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3749{
3750 {
3751 -1,
3752 (gchar *) "units",
3753 (gchar *) "s",
3754 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3755 NULL
3756 },
3757 "units",
3758 FALSE
3759};
3760
3761static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3762{
3763 {
3764 -1,
3765 (gchar *) "poll_interval",
3766 (gchar *) "i",
3767 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3768 NULL
3769 },
3770 "poll-interval",
3771 FALSE
3772};
3773
3774static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3775{
3776 {
3777 -1,
3778 (gchar *) "heatbeat",
3779 (gchar *) "i",
3780 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3781 NULL
3782 },
3783 "heatbeat",
3784 FALSE
3785};
3786
3787static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3788{
3789 {
3790 -1,
3791 (gchar *) "settable",
3792 (gchar *) "b",
3793 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3794 NULL
3795 },
3796 "settable",
3797 FALSE
3798};
3799
Norman James362a80f2015-09-14 14:04:39 -05003800static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3801{
3802 &_sensor_value_property_info_value,
3803 &_sensor_value_property_info_units,
3804 &_sensor_value_property_info_poll_interval,
3805 &_sensor_value_property_info_heatbeat,
3806 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05003807 NULL
3808};
3809
3810static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3811{
3812 {
3813 -1,
3814 (gchar *) "org.openbmc.SensorValue",
3815 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3816 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3817 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3818 NULL
3819 },
3820 "sensor-value",
3821};
3822
3823
3824/**
3825 * sensor_value_interface_info:
3826 *
3827 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3828 *
3829 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3830 */
3831GDBusInterfaceInfo *
3832sensor_value_interface_info (void)
3833{
3834 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3835}
3836
3837/**
3838 * sensor_value_override_properties:
3839 * @klass: The class structure for a #GObject<!-- -->-derived class.
3840 * @property_id_begin: The property id to assign to the first overridden property.
3841 *
3842 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3843 * The properties are overridden in the order they are defined.
3844 *
3845 * Returns: The last property id.
3846 */
3847guint
3848sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3849{
3850 g_object_class_override_property (klass, property_id_begin++, "value");
3851 g_object_class_override_property (klass, property_id_begin++, "units");
3852 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3853 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3854 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05003855 return property_id_begin - 1;
3856}
3857
3858
3859
3860/**
3861 * SensorValue:
3862 *
3863 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3864 */
3865
3866/**
3867 * SensorValueIface:
3868 * @parent_iface: The parent interface.
3869 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3870 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05003871 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05003872 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05003873 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3874 * @get_settable: Getter for the #SensorValue:settable property.
3875 * @get_units: Getter for the #SensorValue:units property.
3876 * @get_value: Getter for the #SensorValue:value property.
3877 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003878 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003879 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3880 *
3881 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3882 */
3883
3884typedef SensorValueIface SensorValueInterface;
3885G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3886
3887static void
3888sensor_value_default_init (SensorValueIface *iface)
3889{
3890 /* GObject signals for incoming D-Bus method calls: */
3891 /**
3892 * SensorValue::handle-init:
3893 * @object: A #SensorValue.
3894 * @invocation: A #GDBusMethodInvocation.
3895 *
3896 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3897 *
3898 * 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.
3899 *
3900 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3901 */
3902 g_signal_new ("handle-init",
3903 G_TYPE_FROM_INTERFACE (iface),
3904 G_SIGNAL_RUN_LAST,
3905 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3906 g_signal_accumulator_true_handled,
3907 NULL,
3908 g_cclosure_marshal_generic,
3909 G_TYPE_BOOLEAN,
3910 1,
3911 G_TYPE_DBUS_METHOD_INVOCATION);
3912
3913 /**
3914 * SensorValue::handle-get-value:
3915 * @object: A #SensorValue.
3916 * @invocation: A #GDBusMethodInvocation.
3917 *
3918 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3919 *
3920 * 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.
3921 *
3922 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3923 */
3924 g_signal_new ("handle-get-value",
3925 G_TYPE_FROM_INTERFACE (iface),
3926 G_SIGNAL_RUN_LAST,
3927 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3928 g_signal_accumulator_true_handled,
3929 NULL,
3930 g_cclosure_marshal_generic,
3931 G_TYPE_BOOLEAN,
3932 1,
3933 G_TYPE_DBUS_METHOD_INVOCATION);
3934
Norman James19e45912015-10-04 20:19:41 -05003935 /**
3936 * SensorValue::handle-set-value:
3937 * @object: A #SensorValue.
3938 * @invocation: A #GDBusMethodInvocation.
3939 * @arg_value: Argument passed by remote caller.
3940 *
3941 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3942 *
3943 * 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.
3944 *
3945 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3946 */
3947 g_signal_new ("handle-set-value",
3948 G_TYPE_FROM_INTERFACE (iface),
3949 G_SIGNAL_RUN_LAST,
3950 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3951 g_signal_accumulator_true_handled,
3952 NULL,
3953 g_cclosure_marshal_generic,
3954 G_TYPE_BOOLEAN,
3955 2,
3956 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3957
Norman James362a80f2015-09-14 14:04:39 -05003958 /* GObject signals for received D-Bus signals: */
3959 /**
3960 * SensorValue::changed:
3961 * @object: A #SensorValue.
3962 * @arg_value: Argument.
3963 * @arg_units: Argument.
3964 *
3965 * 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.
3966 *
3967 * 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.
3968 */
3969 g_signal_new ("changed",
3970 G_TYPE_FROM_INTERFACE (iface),
3971 G_SIGNAL_RUN_LAST,
3972 G_STRUCT_OFFSET (SensorValueIface, changed),
3973 NULL,
3974 NULL,
3975 g_cclosure_marshal_generic,
3976 G_TYPE_NONE,
3977 2, G_TYPE_VARIANT, G_TYPE_STRING);
3978
3979 /**
Norman James32e74e22015-09-15 21:28:06 -05003980 * SensorValue::error:
3981 * @object: A #SensorValue.
3982 *
3983 * 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.
3984 *
3985 * 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.
3986 */
3987 g_signal_new ("error",
3988 G_TYPE_FROM_INTERFACE (iface),
3989 G_SIGNAL_RUN_LAST,
3990 G_STRUCT_OFFSET (SensorValueIface, error),
3991 NULL,
3992 NULL,
3993 g_cclosure_marshal_generic,
3994 G_TYPE_NONE,
3995 0);
3996
3997 /**
Norman James362a80f2015-09-14 14:04:39 -05003998 * SensorValue::heartbeat:
3999 * @object: A #SensorValue.
4000 * @arg_bus_name: Argument.
4001 *
4002 * 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.
4003 *
4004 * 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.
4005 */
4006 g_signal_new ("heartbeat",
4007 G_TYPE_FROM_INTERFACE (iface),
4008 G_SIGNAL_RUN_LAST,
4009 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4010 NULL,
4011 NULL,
4012 g_cclosure_marshal_generic,
4013 G_TYPE_NONE,
4014 1, G_TYPE_STRING);
4015
4016 /* GObject properties for D-Bus properties: */
4017 /**
4018 * SensorValue:value:
4019 *
4020 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4021 *
4022 * 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.
4023 */
4024 g_object_interface_install_property (iface,
4025 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4026 /**
4027 * SensorValue:units:
4028 *
4029 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4030 *
4031 * 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.
4032 */
4033 g_object_interface_install_property (iface,
4034 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4035 /**
4036 * SensorValue:poll-interval:
4037 *
4038 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4039 *
4040 * 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.
4041 */
4042 g_object_interface_install_property (iface,
4043 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4044 /**
4045 * SensorValue:heatbeat:
4046 *
4047 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4048 *
4049 * 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.
4050 */
4051 g_object_interface_install_property (iface,
4052 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4053 /**
4054 * SensorValue:settable:
4055 *
4056 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4057 *
4058 * 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.
4059 */
4060 g_object_interface_install_property (iface,
4061 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004062}
4063
4064/**
4065 * sensor_value_get_value: (skip)
4066 * @object: A #SensorValue.
4067 *
4068 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4069 *
4070 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4071 *
4072 * <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>
4073 *
4074 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4075 */
4076GVariant *
4077sensor_value_get_value (SensorValue *object)
4078{
4079 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4080}
4081
4082/**
4083 * sensor_value_dup_value: (skip)
4084 * @object: A #SensorValue.
4085 *
4086 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4087 *
4088 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4089 *
4090 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4091 */
4092GVariant *
4093sensor_value_dup_value (SensorValue *object)
4094{
4095 GVariant *value;
4096 g_object_get (G_OBJECT (object), "value", &value, NULL);
4097 return value;
4098}
4099
4100/**
4101 * sensor_value_set_value: (skip)
4102 * @object: A #SensorValue.
4103 * @value: The value to set.
4104 *
4105 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4106 *
4107 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4108 */
4109void
4110sensor_value_set_value (SensorValue *object, GVariant *value)
4111{
4112 g_object_set (G_OBJECT (object), "value", value, NULL);
4113}
4114
4115/**
4116 * sensor_value_get_units: (skip)
4117 * @object: A #SensorValue.
4118 *
4119 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4120 *
4121 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4122 *
4123 * <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>
4124 *
4125 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4126 */
4127const gchar *
4128sensor_value_get_units (SensorValue *object)
4129{
4130 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4131}
4132
4133/**
4134 * sensor_value_dup_units: (skip)
4135 * @object: A #SensorValue.
4136 *
4137 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4138 *
4139 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4140 *
4141 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4142 */
4143gchar *
4144sensor_value_dup_units (SensorValue *object)
4145{
4146 gchar *value;
4147 g_object_get (G_OBJECT (object), "units", &value, NULL);
4148 return value;
4149}
4150
4151/**
4152 * sensor_value_set_units: (skip)
4153 * @object: A #SensorValue.
4154 * @value: The value to set.
4155 *
4156 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4157 *
4158 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4159 */
4160void
4161sensor_value_set_units (SensorValue *object, const gchar *value)
4162{
4163 g_object_set (G_OBJECT (object), "units", value, NULL);
4164}
4165
4166/**
4167 * sensor_value_get_poll_interval: (skip)
4168 * @object: A #SensorValue.
4169 *
4170 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4171 *
4172 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4173 *
4174 * Returns: The property value.
4175 */
4176gint
4177sensor_value_get_poll_interval (SensorValue *object)
4178{
4179 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4180}
4181
4182/**
4183 * sensor_value_set_poll_interval: (skip)
4184 * @object: A #SensorValue.
4185 * @value: The value to set.
4186 *
4187 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4188 *
4189 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4190 */
4191void
4192sensor_value_set_poll_interval (SensorValue *object, gint value)
4193{
4194 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4195}
4196
4197/**
4198 * sensor_value_get_heatbeat: (skip)
4199 * @object: A #SensorValue.
4200 *
4201 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4202 *
4203 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4204 *
4205 * Returns: The property value.
4206 */
4207gint
4208sensor_value_get_heatbeat (SensorValue *object)
4209{
4210 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4211}
4212
4213/**
4214 * sensor_value_set_heatbeat: (skip)
4215 * @object: A #SensorValue.
4216 * @value: The value to set.
4217 *
4218 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4219 *
4220 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4221 */
4222void
4223sensor_value_set_heatbeat (SensorValue *object, gint value)
4224{
4225 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4226}
4227
4228/**
4229 * sensor_value_get_settable: (skip)
4230 * @object: A #SensorValue.
4231 *
4232 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4233 *
4234 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4235 *
4236 * Returns: The property value.
4237 */
4238gboolean
4239sensor_value_get_settable (SensorValue *object)
4240{
4241 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4242}
4243
4244/**
4245 * sensor_value_set_settable: (skip)
4246 * @object: A #SensorValue.
4247 * @value: The value to set.
4248 *
4249 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4250 *
4251 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4252 */
4253void
4254sensor_value_set_settable (SensorValue *object, gboolean value)
4255{
4256 g_object_set (G_OBJECT (object), "settable", value, NULL);
4257}
4258
4259/**
Norman James362a80f2015-09-14 14:04:39 -05004260 * sensor_value_emit_changed:
4261 * @object: A #SensorValue.
4262 * @arg_value: Argument to pass with the signal.
4263 * @arg_units: Argument to pass with the signal.
4264 *
4265 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4266 */
4267void
4268sensor_value_emit_changed (
4269 SensorValue *object,
4270 GVariant *arg_value,
4271 const gchar *arg_units)
4272{
4273 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4274}
4275
4276/**
Norman James32e74e22015-09-15 21:28:06 -05004277 * sensor_value_emit_error:
4278 * @object: A #SensorValue.
4279 *
4280 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4281 */
4282void
4283sensor_value_emit_error (
4284 SensorValue *object)
4285{
4286 g_signal_emit_by_name (object, "error");
4287}
4288
4289/**
Norman James362a80f2015-09-14 14:04:39 -05004290 * sensor_value_emit_heartbeat:
4291 * @object: A #SensorValue.
4292 * @arg_bus_name: Argument to pass with the signal.
4293 *
4294 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4295 */
4296void
4297sensor_value_emit_heartbeat (
4298 SensorValue *object,
4299 const gchar *arg_bus_name)
4300{
4301 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4302}
4303
4304/**
4305 * sensor_value_call_init:
4306 * @proxy: A #SensorValueProxy.
4307 * @cancellable: (allow-none): A #GCancellable or %NULL.
4308 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4309 * @user_data: User data to pass to @callback.
4310 *
4311 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4312 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4313 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4314 *
4315 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4316 */
4317void
4318sensor_value_call_init (
4319 SensorValue *proxy,
4320 GCancellable *cancellable,
4321 GAsyncReadyCallback callback,
4322 gpointer user_data)
4323{
4324 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4325 "init",
4326 g_variant_new ("()"),
4327 G_DBUS_CALL_FLAGS_NONE,
4328 -1,
4329 cancellable,
4330 callback,
4331 user_data);
4332}
4333
4334/**
4335 * sensor_value_call_init_finish:
4336 * @proxy: A #SensorValueProxy.
4337 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4338 * @error: Return location for error or %NULL.
4339 *
4340 * Finishes an operation started with sensor_value_call_init().
4341 *
4342 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4343 */
4344gboolean
4345sensor_value_call_init_finish (
4346 SensorValue *proxy,
4347 GAsyncResult *res,
4348 GError **error)
4349{
4350 GVariant *_ret;
4351 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4352 if (_ret == NULL)
4353 goto _out;
4354 g_variant_get (_ret,
4355 "()");
4356 g_variant_unref (_ret);
4357_out:
4358 return _ret != NULL;
4359}
4360
4361/**
4362 * sensor_value_call_init_sync:
4363 * @proxy: A #SensorValueProxy.
4364 * @cancellable: (allow-none): A #GCancellable or %NULL.
4365 * @error: Return location for error or %NULL.
4366 *
4367 * 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.
4368 *
4369 * See sensor_value_call_init() for the asynchronous version of this method.
4370 *
4371 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4372 */
4373gboolean
4374sensor_value_call_init_sync (
4375 SensorValue *proxy,
4376 GCancellable *cancellable,
4377 GError **error)
4378{
4379 GVariant *_ret;
4380 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4381 "init",
4382 g_variant_new ("()"),
4383 G_DBUS_CALL_FLAGS_NONE,
4384 -1,
4385 cancellable,
4386 error);
4387 if (_ret == NULL)
4388 goto _out;
4389 g_variant_get (_ret,
4390 "()");
4391 g_variant_unref (_ret);
4392_out:
4393 return _ret != NULL;
4394}
4395
4396/**
4397 * sensor_value_call_get_value:
4398 * @proxy: A #SensorValueProxy.
4399 * @cancellable: (allow-none): A #GCancellable or %NULL.
4400 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4401 * @user_data: User data to pass to @callback.
4402 *
4403 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4404 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4405 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4406 *
4407 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4408 */
4409void
4410sensor_value_call_get_value (
4411 SensorValue *proxy,
4412 GCancellable *cancellable,
4413 GAsyncReadyCallback callback,
4414 gpointer user_data)
4415{
4416 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4417 "getValue",
4418 g_variant_new ("()"),
4419 G_DBUS_CALL_FLAGS_NONE,
4420 -1,
4421 cancellable,
4422 callback,
4423 user_data);
4424}
4425
4426/**
4427 * sensor_value_call_get_value_finish:
4428 * @proxy: A #SensorValueProxy.
4429 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4430 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4431 * @error: Return location for error or %NULL.
4432 *
4433 * Finishes an operation started with sensor_value_call_get_value().
4434 *
4435 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4436 */
4437gboolean
4438sensor_value_call_get_value_finish (
4439 SensorValue *proxy,
4440 GVariant **out_value,
4441 GAsyncResult *res,
4442 GError **error)
4443{
4444 GVariant *_ret;
4445 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4446 if (_ret == NULL)
4447 goto _out;
4448 g_variant_get (_ret,
4449 "(@v)",
4450 out_value);
4451 g_variant_unref (_ret);
4452_out:
4453 return _ret != NULL;
4454}
4455
4456/**
4457 * sensor_value_call_get_value_sync:
4458 * @proxy: A #SensorValueProxy.
4459 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4460 * @cancellable: (allow-none): A #GCancellable or %NULL.
4461 * @error: Return location for error or %NULL.
4462 *
4463 * 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.
4464 *
4465 * See sensor_value_call_get_value() for the asynchronous version of this method.
4466 *
4467 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4468 */
4469gboolean
4470sensor_value_call_get_value_sync (
4471 SensorValue *proxy,
4472 GVariant **out_value,
4473 GCancellable *cancellable,
4474 GError **error)
4475{
4476 GVariant *_ret;
4477 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4478 "getValue",
4479 g_variant_new ("()"),
4480 G_DBUS_CALL_FLAGS_NONE,
4481 -1,
4482 cancellable,
4483 error);
4484 if (_ret == NULL)
4485 goto _out;
4486 g_variant_get (_ret,
4487 "(@v)",
4488 out_value);
4489 g_variant_unref (_ret);
4490_out:
4491 return _ret != NULL;
4492}
4493
4494/**
Norman James19e45912015-10-04 20:19:41 -05004495 * sensor_value_call_set_value:
4496 * @proxy: A #SensorValueProxy.
4497 * @arg_value: Argument to pass with the method invocation.
4498 * @cancellable: (allow-none): A #GCancellable or %NULL.
4499 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4500 * @user_data: User data to pass to @callback.
4501 *
4502 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4503 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4504 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4505 *
4506 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4507 */
4508void
4509sensor_value_call_set_value (
4510 SensorValue *proxy,
4511 GVariant *arg_value,
4512 GCancellable *cancellable,
4513 GAsyncReadyCallback callback,
4514 gpointer user_data)
4515{
4516 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4517 "setValue",
4518 g_variant_new ("(@v)",
4519 arg_value),
4520 G_DBUS_CALL_FLAGS_NONE,
4521 -1,
4522 cancellable,
4523 callback,
4524 user_data);
4525}
4526
4527/**
4528 * sensor_value_call_set_value_finish:
4529 * @proxy: A #SensorValueProxy.
4530 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4531 * @error: Return location for error or %NULL.
4532 *
4533 * Finishes an operation started with sensor_value_call_set_value().
4534 *
4535 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4536 */
4537gboolean
4538sensor_value_call_set_value_finish (
4539 SensorValue *proxy,
4540 GAsyncResult *res,
4541 GError **error)
4542{
4543 GVariant *_ret;
4544 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4545 if (_ret == NULL)
4546 goto _out;
4547 g_variant_get (_ret,
4548 "()");
4549 g_variant_unref (_ret);
4550_out:
4551 return _ret != NULL;
4552}
4553
4554/**
4555 * sensor_value_call_set_value_sync:
4556 * @proxy: A #SensorValueProxy.
4557 * @arg_value: Argument to pass with the method invocation.
4558 * @cancellable: (allow-none): A #GCancellable or %NULL.
4559 * @error: Return location for error or %NULL.
4560 *
4561 * 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.
4562 *
4563 * See sensor_value_call_set_value() for the asynchronous version of this method.
4564 *
4565 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4566 */
4567gboolean
4568sensor_value_call_set_value_sync (
4569 SensorValue *proxy,
4570 GVariant *arg_value,
4571 GCancellable *cancellable,
4572 GError **error)
4573{
4574 GVariant *_ret;
4575 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4576 "setValue",
4577 g_variant_new ("(@v)",
4578 arg_value),
4579 G_DBUS_CALL_FLAGS_NONE,
4580 -1,
4581 cancellable,
4582 error);
4583 if (_ret == NULL)
4584 goto _out;
4585 g_variant_get (_ret,
4586 "()");
4587 g_variant_unref (_ret);
4588_out:
4589 return _ret != NULL;
4590}
4591
4592/**
Norman James362a80f2015-09-14 14:04:39 -05004593 * sensor_value_complete_init:
4594 * @object: A #SensorValue.
4595 * @invocation: (transfer full): A #GDBusMethodInvocation.
4596 *
4597 * 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.
4598 *
4599 * This method will free @invocation, you cannot use it afterwards.
4600 */
4601void
4602sensor_value_complete_init (
4603 SensorValue *object,
4604 GDBusMethodInvocation *invocation)
4605{
4606 g_dbus_method_invocation_return_value (invocation,
4607 g_variant_new ("()"));
4608}
4609
4610/**
4611 * sensor_value_complete_get_value:
4612 * @object: A #SensorValue.
4613 * @invocation: (transfer full): A #GDBusMethodInvocation.
4614 * @value: Parameter to return.
4615 *
4616 * 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.
4617 *
4618 * This method will free @invocation, you cannot use it afterwards.
4619 */
4620void
4621sensor_value_complete_get_value (
4622 SensorValue *object,
4623 GDBusMethodInvocation *invocation,
4624 GVariant *value)
4625{
4626 g_dbus_method_invocation_return_value (invocation,
4627 g_variant_new ("(@v)",
4628 value));
4629}
4630
Norman James19e45912015-10-04 20:19:41 -05004631/**
4632 * sensor_value_complete_set_value:
4633 * @object: A #SensorValue.
4634 * @invocation: (transfer full): A #GDBusMethodInvocation.
4635 *
4636 * 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.
4637 *
4638 * This method will free @invocation, you cannot use it afterwards.
4639 */
4640void
4641sensor_value_complete_set_value (
4642 SensorValue *object,
4643 GDBusMethodInvocation *invocation)
4644{
4645 g_dbus_method_invocation_return_value (invocation,
4646 g_variant_new ("()"));
4647}
4648
Norman James362a80f2015-09-14 14:04:39 -05004649/* ------------------------------------------------------------------------ */
4650
4651/**
4652 * SensorValueProxy:
4653 *
4654 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4655 */
4656
4657/**
4658 * SensorValueProxyClass:
4659 * @parent_class: The parent class.
4660 *
4661 * Class structure for #SensorValueProxy.
4662 */
4663
4664struct _SensorValueProxyPrivate
4665{
4666 GData *qdata;
4667};
4668
4669static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4670
4671#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4672G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4673 G_ADD_PRIVATE (SensorValueProxy)
4674 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4675
4676#else
4677G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4678 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4679
4680#endif
4681static void
4682sensor_value_proxy_finalize (GObject *object)
4683{
4684 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4685 g_datalist_clear (&proxy->priv->qdata);
4686 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4687}
4688
4689static void
4690sensor_value_proxy_get_property (GObject *object,
4691 guint prop_id,
4692 GValue *value,
4693 GParamSpec *pspec G_GNUC_UNUSED)
4694{
4695 const _ExtendedGDBusPropertyInfo *info;
4696 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004697 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004698 info = _sensor_value_property_info_pointers[prop_id - 1];
4699 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4700 if (info->use_gvariant)
4701 {
4702 g_value_set_variant (value, variant);
4703 }
4704 else
4705 {
4706 if (variant != NULL)
4707 g_dbus_gvariant_to_gvalue (variant, value);
4708 }
4709 if (variant != NULL)
4710 g_variant_unref (variant);
4711}
4712
4713static void
4714sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4715 GAsyncResult *res,
4716 gpointer user_data)
4717{
4718 const _ExtendedGDBusPropertyInfo *info = user_data;
4719 GError *error;
4720 GVariant *_ret;
4721 error = NULL;
4722 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4723 if (!_ret)
4724 {
4725 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4726 info->parent_struct.name,
4727 error->message, g_quark_to_string (error->domain), error->code);
4728 g_error_free (error);
4729 }
4730 else
4731 {
4732 g_variant_unref (_ret);
4733 }
4734}
4735
4736static void
4737sensor_value_proxy_set_property (GObject *object,
4738 guint prop_id,
4739 const GValue *value,
4740 GParamSpec *pspec G_GNUC_UNUSED)
4741{
4742 const _ExtendedGDBusPropertyInfo *info;
4743 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004744 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004745 info = _sensor_value_property_info_pointers[prop_id - 1];
4746 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4747 g_dbus_proxy_call (G_DBUS_PROXY (object),
4748 "org.freedesktop.DBus.Properties.Set",
4749 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4750 G_DBUS_CALL_FLAGS_NONE,
4751 -1,
4752 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4753 g_variant_unref (variant);
4754}
4755
4756static void
4757sensor_value_proxy_g_signal (GDBusProxy *proxy,
4758 const gchar *sender_name G_GNUC_UNUSED,
4759 const gchar *signal_name,
4760 GVariant *parameters)
4761{
4762 _ExtendedGDBusSignalInfo *info;
4763 GVariantIter iter;
4764 GVariant *child;
4765 GValue *paramv;
4766 guint num_params;
4767 guint n;
4768 guint signal_id;
4769 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4770 if (info == NULL)
4771 return;
4772 num_params = g_variant_n_children (parameters);
4773 paramv = g_new0 (GValue, num_params + 1);
4774 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4775 g_value_set_object (&paramv[0], proxy);
4776 g_variant_iter_init (&iter, parameters);
4777 n = 1;
4778 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4779 {
4780 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4781 if (arg_info->use_gvariant)
4782 {
4783 g_value_init (&paramv[n], G_TYPE_VARIANT);
4784 g_value_set_variant (&paramv[n], child);
4785 n++;
4786 }
4787 else
4788 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4789 g_variant_unref (child);
4790 }
4791 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4792 g_signal_emitv (paramv, signal_id, 0, NULL);
4793 for (n = 0; n < num_params + 1; n++)
4794 g_value_unset (&paramv[n]);
4795 g_free (paramv);
4796}
4797
4798static void
4799sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4800 GVariant *changed_properties,
4801 const gchar *const *invalidated_properties)
4802{
4803 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4804 guint n;
4805 const gchar *key;
4806 GVariantIter *iter;
4807 _ExtendedGDBusPropertyInfo *info;
4808 g_variant_get (changed_properties, "a{sv}", &iter);
4809 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4810 {
4811 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4812 g_datalist_remove_data (&proxy->priv->qdata, key);
4813 if (info != NULL)
4814 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4815 }
4816 g_variant_iter_free (iter);
4817 for (n = 0; invalidated_properties[n] != NULL; n++)
4818 {
4819 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4820 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4821 if (info != NULL)
4822 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4823 }
4824}
4825
4826static GVariant *
4827sensor_value_proxy_get_value (SensorValue *object)
4828{
4829 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4830 GVariant *variant;
4831 GVariant *value = NULL;
4832 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4833 value = variant;
4834 if (variant != NULL)
4835 g_variant_unref (variant);
4836 return value;
4837}
4838
4839static const gchar *
4840sensor_value_proxy_get_units (SensorValue *object)
4841{
4842 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4843 GVariant *variant;
4844 const gchar *value = NULL;
4845 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4846 if (variant != NULL)
4847 {
4848 value = g_variant_get_string (variant, NULL);
4849 g_variant_unref (variant);
4850 }
4851 return value;
4852}
4853
4854static gint
4855sensor_value_proxy_get_poll_interval (SensorValue *object)
4856{
4857 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4858 GVariant *variant;
4859 gint value = 0;
4860 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4861 if (variant != NULL)
4862 {
4863 value = g_variant_get_int32 (variant);
4864 g_variant_unref (variant);
4865 }
4866 return value;
4867}
4868
4869static gint
4870sensor_value_proxy_get_heatbeat (SensorValue *object)
4871{
4872 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4873 GVariant *variant;
4874 gint value = 0;
4875 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4876 if (variant != NULL)
4877 {
4878 value = g_variant_get_int32 (variant);
4879 g_variant_unref (variant);
4880 }
4881 return value;
4882}
4883
4884static gboolean
4885sensor_value_proxy_get_settable (SensorValue *object)
4886{
4887 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4888 GVariant *variant;
4889 gboolean value = 0;
4890 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4891 if (variant != NULL)
4892 {
4893 value = g_variant_get_boolean (variant);
4894 g_variant_unref (variant);
4895 }
4896 return value;
4897}
4898
Norman James362a80f2015-09-14 14:04:39 -05004899static void
4900sensor_value_proxy_init (SensorValueProxy *proxy)
4901{
4902#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4903 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4904#else
4905 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4906#endif
4907
4908 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4909}
4910
4911static void
4912sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4913{
4914 GObjectClass *gobject_class;
4915 GDBusProxyClass *proxy_class;
4916
4917 gobject_class = G_OBJECT_CLASS (klass);
4918 gobject_class->finalize = sensor_value_proxy_finalize;
4919 gobject_class->get_property = sensor_value_proxy_get_property;
4920 gobject_class->set_property = sensor_value_proxy_set_property;
4921
4922 proxy_class = G_DBUS_PROXY_CLASS (klass);
4923 proxy_class->g_signal = sensor_value_proxy_g_signal;
4924 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4925
4926 sensor_value_override_properties (gobject_class, 1);
4927
4928#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4929 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4930#endif
4931}
4932
4933static void
4934sensor_value_proxy_iface_init (SensorValueIface *iface)
4935{
4936 iface->get_value = sensor_value_proxy_get_value;
4937 iface->get_units = sensor_value_proxy_get_units;
4938 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4939 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4940 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004941}
4942
4943/**
4944 * sensor_value_proxy_new:
4945 * @connection: A #GDBusConnection.
4946 * @flags: Flags from the #GDBusProxyFlags enumeration.
4947 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4948 * @object_path: An object path.
4949 * @cancellable: (allow-none): A #GCancellable or %NULL.
4950 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4951 * @user_data: User data to pass to @callback.
4952 *
4953 * 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.
4954 *
4955 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4956 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4957 *
4958 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4959 */
4960void
4961sensor_value_proxy_new (
4962 GDBusConnection *connection,
4963 GDBusProxyFlags flags,
4964 const gchar *name,
4965 const gchar *object_path,
4966 GCancellable *cancellable,
4967 GAsyncReadyCallback callback,
4968 gpointer user_data)
4969{
4970 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);
4971}
4972
4973/**
4974 * sensor_value_proxy_new_finish:
4975 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4976 * @error: Return location for error or %NULL
4977 *
4978 * Finishes an operation started with sensor_value_proxy_new().
4979 *
4980 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4981 */
4982SensorValue *
4983sensor_value_proxy_new_finish (
4984 GAsyncResult *res,
4985 GError **error)
4986{
4987 GObject *ret;
4988 GObject *source_object;
4989 source_object = g_async_result_get_source_object (res);
4990 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4991 g_object_unref (source_object);
4992 if (ret != NULL)
4993 return SENSOR_VALUE (ret);
4994 else
4995 return NULL;
4996}
4997
4998/**
4999 * sensor_value_proxy_new_sync:
5000 * @connection: A #GDBusConnection.
5001 * @flags: Flags from the #GDBusProxyFlags enumeration.
5002 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5003 * @object_path: An object path.
5004 * @cancellable: (allow-none): A #GCancellable or %NULL.
5005 * @error: Return location for error or %NULL
5006 *
5007 * 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.
5008 *
5009 * The calling thread is blocked until a reply is received.
5010 *
5011 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5012 *
5013 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5014 */
5015SensorValue *
5016sensor_value_proxy_new_sync (
5017 GDBusConnection *connection,
5018 GDBusProxyFlags flags,
5019 const gchar *name,
5020 const gchar *object_path,
5021 GCancellable *cancellable,
5022 GError **error)
5023{
5024 GInitable *ret;
5025 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);
5026 if (ret != NULL)
5027 return SENSOR_VALUE (ret);
5028 else
5029 return NULL;
5030}
5031
5032
5033/**
5034 * sensor_value_proxy_new_for_bus:
5035 * @bus_type: A #GBusType.
5036 * @flags: Flags from the #GDBusProxyFlags enumeration.
5037 * @name: A bus name (well-known or unique).
5038 * @object_path: An object path.
5039 * @cancellable: (allow-none): A #GCancellable or %NULL.
5040 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5041 * @user_data: User data to pass to @callback.
5042 *
5043 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5044 *
5045 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5046 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5047 *
5048 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5049 */
5050void
5051sensor_value_proxy_new_for_bus (
5052 GBusType bus_type,
5053 GDBusProxyFlags flags,
5054 const gchar *name,
5055 const gchar *object_path,
5056 GCancellable *cancellable,
5057 GAsyncReadyCallback callback,
5058 gpointer user_data)
5059{
5060 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);
5061}
5062
5063/**
5064 * sensor_value_proxy_new_for_bus_finish:
5065 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5066 * @error: Return location for error or %NULL
5067 *
5068 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5069 *
5070 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5071 */
5072SensorValue *
5073sensor_value_proxy_new_for_bus_finish (
5074 GAsyncResult *res,
5075 GError **error)
5076{
5077 GObject *ret;
5078 GObject *source_object;
5079 source_object = g_async_result_get_source_object (res);
5080 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5081 g_object_unref (source_object);
5082 if (ret != NULL)
5083 return SENSOR_VALUE (ret);
5084 else
5085 return NULL;
5086}
5087
5088/**
5089 * sensor_value_proxy_new_for_bus_sync:
5090 * @bus_type: A #GBusType.
5091 * @flags: Flags from the #GDBusProxyFlags enumeration.
5092 * @name: A bus name (well-known or unique).
5093 * @object_path: An object path.
5094 * @cancellable: (allow-none): A #GCancellable or %NULL.
5095 * @error: Return location for error or %NULL
5096 *
5097 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5098 *
5099 * The calling thread is blocked until a reply is received.
5100 *
5101 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5102 *
5103 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5104 */
5105SensorValue *
5106sensor_value_proxy_new_for_bus_sync (
5107 GBusType bus_type,
5108 GDBusProxyFlags flags,
5109 const gchar *name,
5110 const gchar *object_path,
5111 GCancellable *cancellable,
5112 GError **error)
5113{
5114 GInitable *ret;
5115 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);
5116 if (ret != NULL)
5117 return SENSOR_VALUE (ret);
5118 else
5119 return NULL;
5120}
5121
5122
5123/* ------------------------------------------------------------------------ */
5124
5125/**
5126 * SensorValueSkeleton:
5127 *
5128 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5129 */
5130
5131/**
5132 * SensorValueSkeletonClass:
5133 * @parent_class: The parent class.
5134 *
5135 * Class structure for #SensorValueSkeleton.
5136 */
5137
5138struct _SensorValueSkeletonPrivate
5139{
5140 GValue *properties;
5141 GList *changed_properties;
5142 GSource *changed_properties_idle_source;
5143 GMainContext *context;
5144 GMutex lock;
5145};
5146
5147static void
5148_sensor_value_skeleton_handle_method_call (
5149 GDBusConnection *connection G_GNUC_UNUSED,
5150 const gchar *sender G_GNUC_UNUSED,
5151 const gchar *object_path G_GNUC_UNUSED,
5152 const gchar *interface_name,
5153 const gchar *method_name,
5154 GVariant *parameters,
5155 GDBusMethodInvocation *invocation,
5156 gpointer user_data)
5157{
5158 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5159 _ExtendedGDBusMethodInfo *info;
5160 GVariantIter iter;
5161 GVariant *child;
5162 GValue *paramv;
5163 guint num_params;
5164 guint num_extra;
5165 guint n;
5166 guint signal_id;
5167 GValue return_value = G_VALUE_INIT;
5168 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5169 g_assert (info != NULL);
5170 num_params = g_variant_n_children (parameters);
5171 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5172 n = 0;
5173 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5174 g_value_set_object (&paramv[n++], skeleton);
5175 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5176 g_value_set_object (&paramv[n++], invocation);
5177 if (info->pass_fdlist)
5178 {
5179#ifdef G_OS_UNIX
5180 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5181 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5182#else
5183 g_assert_not_reached ();
5184#endif
5185 }
5186 g_variant_iter_init (&iter, parameters);
5187 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5188 {
5189 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5190 if (arg_info->use_gvariant)
5191 {
5192 g_value_init (&paramv[n], G_TYPE_VARIANT);
5193 g_value_set_variant (&paramv[n], child);
5194 n++;
5195 }
5196 else
5197 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5198 g_variant_unref (child);
5199 }
5200 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5201 g_value_init (&return_value, G_TYPE_BOOLEAN);
5202 g_signal_emitv (paramv, signal_id, 0, &return_value);
5203 if (!g_value_get_boolean (&return_value))
5204 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);
5205 g_value_unset (&return_value);
5206 for (n = 0; n < num_params + num_extra; n++)
5207 g_value_unset (&paramv[n]);
5208 g_free (paramv);
5209}
5210
5211static GVariant *
5212_sensor_value_skeleton_handle_get_property (
5213 GDBusConnection *connection G_GNUC_UNUSED,
5214 const gchar *sender G_GNUC_UNUSED,
5215 const gchar *object_path G_GNUC_UNUSED,
5216 const gchar *interface_name G_GNUC_UNUSED,
5217 const gchar *property_name,
5218 GError **error,
5219 gpointer user_data)
5220{
5221 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5222 GValue value = G_VALUE_INIT;
5223 GParamSpec *pspec;
5224 _ExtendedGDBusPropertyInfo *info;
5225 GVariant *ret;
5226 ret = NULL;
5227 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5228 g_assert (info != NULL);
5229 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5230 if (pspec == NULL)
5231 {
5232 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5233 }
5234 else
5235 {
5236 g_value_init (&value, pspec->value_type);
5237 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5238 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5239 g_value_unset (&value);
5240 }
5241 return ret;
5242}
5243
5244static gboolean
5245_sensor_value_skeleton_handle_set_property (
5246 GDBusConnection *connection G_GNUC_UNUSED,
5247 const gchar *sender G_GNUC_UNUSED,
5248 const gchar *object_path G_GNUC_UNUSED,
5249 const gchar *interface_name G_GNUC_UNUSED,
5250 const gchar *property_name,
5251 GVariant *variant,
5252 GError **error,
5253 gpointer user_data)
5254{
5255 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5256 GValue value = G_VALUE_INIT;
5257 GParamSpec *pspec;
5258 _ExtendedGDBusPropertyInfo *info;
5259 gboolean ret;
5260 ret = FALSE;
5261 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5262 g_assert (info != NULL);
5263 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5264 if (pspec == NULL)
5265 {
5266 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5267 }
5268 else
5269 {
5270 if (info->use_gvariant)
5271 g_value_set_variant (&value, variant);
5272 else
5273 g_dbus_gvariant_to_gvalue (variant, &value);
5274 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5275 g_value_unset (&value);
5276 ret = TRUE;
5277 }
5278 return ret;
5279}
5280
5281static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5282{
5283 _sensor_value_skeleton_handle_method_call,
5284 _sensor_value_skeleton_handle_get_property,
5285 _sensor_value_skeleton_handle_set_property,
5286 {NULL}
5287};
5288
5289static GDBusInterfaceInfo *
5290sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5291{
5292 return sensor_value_interface_info ();
5293}
5294
5295static GDBusInterfaceVTable *
5296sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5297{
5298 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5299}
5300
5301static GVariant *
5302sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5303{
5304 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5305
5306 GVariantBuilder builder;
5307 guint n;
5308 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5309 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5310 goto out;
5311 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5312 {
5313 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5314 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5315 {
5316 GVariant *value;
5317 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);
5318 if (value != NULL)
5319 {
5320 g_variant_take_ref (value);
5321 g_variant_builder_add (&builder, "{sv}", info->name, value);
5322 g_variant_unref (value);
5323 }
5324 }
5325 }
5326out:
5327 return g_variant_builder_end (&builder);
5328}
5329
5330static gboolean _sensor_value_emit_changed (gpointer user_data);
5331
5332static void
5333sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5334{
5335 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5336 gboolean emit_changed = FALSE;
5337
5338 g_mutex_lock (&skeleton->priv->lock);
5339 if (skeleton->priv->changed_properties_idle_source != NULL)
5340 {
5341 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5342 skeleton->priv->changed_properties_idle_source = NULL;
5343 emit_changed = TRUE;
5344 }
5345 g_mutex_unlock (&skeleton->priv->lock);
5346
5347 if (emit_changed)
5348 _sensor_value_emit_changed (skeleton);
5349}
5350
5351static void
5352_sensor_value_on_signal_changed (
5353 SensorValue *object,
5354 GVariant *arg_value,
5355 const gchar *arg_units)
5356{
5357 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5358
5359 GList *connections, *l;
5360 GVariant *signal_variant;
5361 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5362
5363 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5364 arg_value,
5365 arg_units));
5366 for (l = connections; l != NULL; l = l->next)
5367 {
5368 GDBusConnection *connection = l->data;
5369 g_dbus_connection_emit_signal (connection,
5370 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5371 signal_variant, NULL);
5372 }
5373 g_variant_unref (signal_variant);
5374 g_list_free_full (connections, g_object_unref);
5375}
5376
5377static void
Norman James32e74e22015-09-15 21:28:06 -05005378_sensor_value_on_signal_error (
5379 SensorValue *object)
5380{
5381 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5382
5383 GList *connections, *l;
5384 GVariant *signal_variant;
5385 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5386
5387 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5388 for (l = connections; l != NULL; l = l->next)
5389 {
5390 GDBusConnection *connection = l->data;
5391 g_dbus_connection_emit_signal (connection,
5392 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5393 signal_variant, NULL);
5394 }
5395 g_variant_unref (signal_variant);
5396 g_list_free_full (connections, g_object_unref);
5397}
5398
5399static void
Norman James362a80f2015-09-14 14:04:39 -05005400_sensor_value_on_signal_heartbeat (
5401 SensorValue *object,
5402 const gchar *arg_bus_name)
5403{
5404 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5405
5406 GList *connections, *l;
5407 GVariant *signal_variant;
5408 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5409
5410 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5411 arg_bus_name));
5412 for (l = connections; l != NULL; l = l->next)
5413 {
5414 GDBusConnection *connection = l->data;
5415 g_dbus_connection_emit_signal (connection,
5416 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5417 signal_variant, NULL);
5418 }
5419 g_variant_unref (signal_variant);
5420 g_list_free_full (connections, g_object_unref);
5421}
5422
5423static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5424#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5425G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5426 G_ADD_PRIVATE (SensorValueSkeleton)
5427 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5428
5429#else
5430G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5431 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5432
5433#endif
5434static void
5435sensor_value_skeleton_finalize (GObject *object)
5436{
5437 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5438 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005439 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005440 g_value_unset (&skeleton->priv->properties[n]);
5441 g_free (skeleton->priv->properties);
5442 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5443 if (skeleton->priv->changed_properties_idle_source != NULL)
5444 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5445 g_main_context_unref (skeleton->priv->context);
5446 g_mutex_clear (&skeleton->priv->lock);
5447 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5448}
5449
5450static void
5451sensor_value_skeleton_get_property (GObject *object,
5452 guint prop_id,
5453 GValue *value,
5454 GParamSpec *pspec G_GNUC_UNUSED)
5455{
5456 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005457 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005458 g_mutex_lock (&skeleton->priv->lock);
5459 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5460 g_mutex_unlock (&skeleton->priv->lock);
5461}
5462
5463static gboolean
5464_sensor_value_emit_changed (gpointer user_data)
5465{
5466 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5467 GList *l;
5468 GVariantBuilder builder;
5469 GVariantBuilder invalidated_builder;
5470 guint num_changes;
5471
5472 g_mutex_lock (&skeleton->priv->lock);
5473 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5474 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5475 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5476 {
5477 ChangedProperty *cp = l->data;
5478 GVariant *variant;
5479 const GValue *cur_value;
5480
5481 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5482 if (!_g_value_equal (cur_value, &cp->orig_value))
5483 {
5484 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5485 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5486 g_variant_unref (variant);
5487 num_changes++;
5488 }
5489 }
5490 if (num_changes > 0)
5491 {
5492 GList *connections, *ll;
5493 GVariant *signal_variant;
5494 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5495 &builder, &invalidated_builder));
5496 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5497 for (ll = connections; ll != NULL; ll = ll->next)
5498 {
5499 GDBusConnection *connection = ll->data;
5500
5501 g_dbus_connection_emit_signal (connection,
5502 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5503 "org.freedesktop.DBus.Properties",
5504 "PropertiesChanged",
5505 signal_variant,
5506 NULL);
5507 }
5508 g_variant_unref (signal_variant);
5509 g_list_free_full (connections, g_object_unref);
5510 }
5511 else
5512 {
5513 g_variant_builder_clear (&builder);
5514 g_variant_builder_clear (&invalidated_builder);
5515 }
5516 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5517 skeleton->priv->changed_properties = NULL;
5518 skeleton->priv->changed_properties_idle_source = NULL;
5519 g_mutex_unlock (&skeleton->priv->lock);
5520 return FALSE;
5521}
5522
5523static void
5524_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5525{
5526 ChangedProperty *cp;
5527 GList *l;
5528 cp = NULL;
5529 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5530 {
5531 ChangedProperty *i_cp = l->data;
5532 if (i_cp->info == info)
5533 {
5534 cp = i_cp;
5535 break;
5536 }
5537 }
5538 if (cp == NULL)
5539 {
5540 cp = g_new0 (ChangedProperty, 1);
5541 cp->prop_id = prop_id;
5542 cp->info = info;
5543 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5544 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5545 g_value_copy (orig_value, &cp->orig_value);
5546 }
5547}
5548
5549static void
5550sensor_value_skeleton_notify (GObject *object,
5551 GParamSpec *pspec G_GNUC_UNUSED)
5552{
5553 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5554 g_mutex_lock (&skeleton->priv->lock);
5555 if (skeleton->priv->changed_properties != NULL &&
5556 skeleton->priv->changed_properties_idle_source == NULL)
5557 {
5558 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5559 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5560 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5561 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5562 g_source_unref (skeleton->priv->changed_properties_idle_source);
5563 }
5564 g_mutex_unlock (&skeleton->priv->lock);
5565}
5566
5567static void
5568sensor_value_skeleton_set_property (GObject *object,
5569 guint prop_id,
5570 const GValue *value,
5571 GParamSpec *pspec)
5572{
5573 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005574 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005575 g_mutex_lock (&skeleton->priv->lock);
5576 g_object_freeze_notify (object);
5577 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5578 {
5579 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5580 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5581 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5582 g_object_notify_by_pspec (object, pspec);
5583 }
5584 g_mutex_unlock (&skeleton->priv->lock);
5585 g_object_thaw_notify (object);
5586}
5587
5588static void
5589sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5590{
5591#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5592 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5593#else
5594 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5595#endif
5596
5597 g_mutex_init (&skeleton->priv->lock);
5598 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05005599 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05005600 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5601 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5602 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5603 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5604 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05005605}
5606
5607static GVariant *
5608sensor_value_skeleton_get_value (SensorValue *object)
5609{
5610 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5611 GVariant *value;
5612 g_mutex_lock (&skeleton->priv->lock);
5613 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5614 g_mutex_unlock (&skeleton->priv->lock);
5615 return value;
5616}
5617
5618static const gchar *
5619sensor_value_skeleton_get_units (SensorValue *object)
5620{
5621 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5622 const gchar *value;
5623 g_mutex_lock (&skeleton->priv->lock);
5624 value = g_value_get_string (&(skeleton->priv->properties[1]));
5625 g_mutex_unlock (&skeleton->priv->lock);
5626 return value;
5627}
5628
5629static gint
5630sensor_value_skeleton_get_poll_interval (SensorValue *object)
5631{
5632 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5633 gint value;
5634 g_mutex_lock (&skeleton->priv->lock);
5635 value = g_value_get_int (&(skeleton->priv->properties[2]));
5636 g_mutex_unlock (&skeleton->priv->lock);
5637 return value;
5638}
5639
5640static gint
5641sensor_value_skeleton_get_heatbeat (SensorValue *object)
5642{
5643 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5644 gint value;
5645 g_mutex_lock (&skeleton->priv->lock);
5646 value = g_value_get_int (&(skeleton->priv->properties[3]));
5647 g_mutex_unlock (&skeleton->priv->lock);
5648 return value;
5649}
5650
5651static gboolean
5652sensor_value_skeleton_get_settable (SensorValue *object)
5653{
5654 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5655 gboolean value;
5656 g_mutex_lock (&skeleton->priv->lock);
5657 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5658 g_mutex_unlock (&skeleton->priv->lock);
5659 return value;
5660}
5661
Norman James362a80f2015-09-14 14:04:39 -05005662static void
5663sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5664{
5665 GObjectClass *gobject_class;
5666 GDBusInterfaceSkeletonClass *skeleton_class;
5667
5668 gobject_class = G_OBJECT_CLASS (klass);
5669 gobject_class->finalize = sensor_value_skeleton_finalize;
5670 gobject_class->get_property = sensor_value_skeleton_get_property;
5671 gobject_class->set_property = sensor_value_skeleton_set_property;
5672 gobject_class->notify = sensor_value_skeleton_notify;
5673
5674
5675 sensor_value_override_properties (gobject_class, 1);
5676
5677 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5678 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5679 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5680 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5681 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5682
5683#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5684 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5685#endif
5686}
5687
5688static void
5689sensor_value_skeleton_iface_init (SensorValueIface *iface)
5690{
5691 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005692 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005693 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5694 iface->get_value = sensor_value_skeleton_get_value;
5695 iface->get_units = sensor_value_skeleton_get_units;
5696 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5697 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5698 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005699}
5700
5701/**
5702 * sensor_value_skeleton_new:
5703 *
5704 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5705 *
5706 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5707 */
5708SensorValue *
5709sensor_value_skeleton_new (void)
5710{
5711 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5712}
5713
5714/* ------------------------------------------------------------------------
5715 * Code for interface org.openbmc.SensorThreshold
5716 * ------------------------------------------------------------------------
5717 */
5718
5719/**
5720 * SECTION:SensorThreshold
5721 * @title: SensorThreshold
5722 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5723 *
5724 * 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.
5725 */
5726
5727/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5728
5729static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5730{
5731 {
5732 -1,
5733 (gchar *) "state",
5734 (gchar *) "y",
5735 NULL
5736 },
5737 FALSE
5738};
5739
5740static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5741{
5742 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5743 NULL
5744};
5745
5746static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5747{
5748 {
5749 -1,
5750 (gchar *) "getState",
5751 NULL,
5752 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5753 NULL
5754 },
5755 "handle-get-state",
5756 FALSE
5757};
5758
5759static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5760{
5761 &_sensor_threshold_method_info_get_state,
5762 NULL
5763};
5764
5765static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5766{
5767 {
5768 -1,
5769 (gchar *) "Warning",
5770 NULL,
5771 NULL
5772 },
5773 "warning"
5774};
5775
5776static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5777{
5778 {
5779 -1,
5780 (gchar *) "Critical",
5781 NULL,
5782 NULL
5783 },
5784 "critical"
5785};
5786
5787static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5788{
5789 {
5790 -1,
5791 (gchar *) "Normal",
5792 NULL,
5793 NULL
5794 },
5795 "normal"
5796};
5797
5798static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5799{
5800 &_sensor_threshold_signal_info_warning,
5801 &_sensor_threshold_signal_info_critical,
5802 &_sensor_threshold_signal_info_normal,
5803 NULL
5804};
5805
5806static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5807{
5808 {
5809 -1,
5810 (gchar *) "lower_critical",
5811 (gchar *) "v",
5812 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5813 NULL
5814 },
5815 "lower-critical",
5816 FALSE
5817};
5818
5819static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5820{
5821 {
5822 -1,
5823 (gchar *) "lower_warning",
5824 (gchar *) "v",
5825 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5826 NULL
5827 },
5828 "lower-warning",
5829 FALSE
5830};
5831
5832static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
5833{
5834 {
5835 -1,
5836 (gchar *) "upper_warning",
5837 (gchar *) "v",
5838 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5839 NULL
5840 },
5841 "upper-warning",
5842 FALSE
5843};
5844
5845static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
5846{
5847 {
5848 -1,
5849 (gchar *) "upper_critical",
5850 (gchar *) "v",
5851 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5852 NULL
5853 },
5854 "upper-critical",
5855 FALSE
5856};
5857
5858static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
5859{
5860 {
5861 -1,
5862 (gchar *) "state",
5863 (gchar *) "y",
5864 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5865 NULL
5866 },
5867 "state",
5868 FALSE
5869};
5870
5871static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
5872{
5873 &_sensor_threshold_property_info_lower_critical,
5874 &_sensor_threshold_property_info_lower_warning,
5875 &_sensor_threshold_property_info_upper_warning,
5876 &_sensor_threshold_property_info_upper_critical,
5877 &_sensor_threshold_property_info_state,
5878 NULL
5879};
5880
5881static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
5882{
5883 {
5884 -1,
5885 (gchar *) "org.openbmc.SensorThreshold",
5886 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
5887 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
5888 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
5889 NULL
5890 },
5891 "sensor-threshold",
5892};
5893
5894
5895/**
5896 * sensor_threshold_interface_info:
5897 *
5898 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
5899 *
5900 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5901 */
5902GDBusInterfaceInfo *
5903sensor_threshold_interface_info (void)
5904{
5905 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
5906}
5907
5908/**
5909 * sensor_threshold_override_properties:
5910 * @klass: The class structure for a #GObject<!-- -->-derived class.
5911 * @property_id_begin: The property id to assign to the first overridden property.
5912 *
5913 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
5914 * The properties are overridden in the order they are defined.
5915 *
5916 * Returns: The last property id.
5917 */
5918guint
5919sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
5920{
5921 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
5922 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
5923 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
5924 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
5925 g_object_class_override_property (klass, property_id_begin++, "state");
5926 return property_id_begin - 1;
5927}
5928
5929
5930
5931/**
5932 * SensorThreshold:
5933 *
5934 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5935 */
5936
5937/**
5938 * SensorThresholdIface:
5939 * @parent_iface: The parent interface.
5940 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
5941 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
5942 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
5943 * @get_state: Getter for the #SensorThreshold:state property.
5944 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
5945 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
5946 * @critical: Handler for the #SensorThreshold::critical signal.
5947 * @normal: Handler for the #SensorThreshold::normal signal.
5948 * @warning: Handler for the #SensorThreshold::warning signal.
5949 *
5950 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5951 */
5952
5953typedef SensorThresholdIface SensorThresholdInterface;
5954G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
5955
5956static void
5957sensor_threshold_default_init (SensorThresholdIface *iface)
5958{
5959 /* GObject signals for incoming D-Bus method calls: */
5960 /**
5961 * SensorThreshold::handle-get-state:
5962 * @object: A #SensorThreshold.
5963 * @invocation: A #GDBusMethodInvocation.
5964 *
5965 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
5966 *
5967 * 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.
5968 *
5969 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5970 */
5971 g_signal_new ("handle-get-state",
5972 G_TYPE_FROM_INTERFACE (iface),
5973 G_SIGNAL_RUN_LAST,
5974 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
5975 g_signal_accumulator_true_handled,
5976 NULL,
5977 g_cclosure_marshal_generic,
5978 G_TYPE_BOOLEAN,
5979 1,
5980 G_TYPE_DBUS_METHOD_INVOCATION);
5981
5982 /* GObject signals for received D-Bus signals: */
5983 /**
5984 * SensorThreshold::warning:
5985 * @object: A #SensorThreshold.
5986 *
5987 * 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.
5988 *
5989 * 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.
5990 */
5991 g_signal_new ("warning",
5992 G_TYPE_FROM_INTERFACE (iface),
5993 G_SIGNAL_RUN_LAST,
5994 G_STRUCT_OFFSET (SensorThresholdIface, warning),
5995 NULL,
5996 NULL,
5997 g_cclosure_marshal_generic,
5998 G_TYPE_NONE,
5999 0);
6000
6001 /**
6002 * SensorThreshold::critical:
6003 * @object: A #SensorThreshold.
6004 *
6005 * 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.
6006 *
6007 * 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.
6008 */
6009 g_signal_new ("critical",
6010 G_TYPE_FROM_INTERFACE (iface),
6011 G_SIGNAL_RUN_LAST,
6012 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6013 NULL,
6014 NULL,
6015 g_cclosure_marshal_generic,
6016 G_TYPE_NONE,
6017 0);
6018
6019 /**
6020 * SensorThreshold::normal:
6021 * @object: A #SensorThreshold.
6022 *
6023 * 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.
6024 *
6025 * 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.
6026 */
6027 g_signal_new ("normal",
6028 G_TYPE_FROM_INTERFACE (iface),
6029 G_SIGNAL_RUN_LAST,
6030 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6031 NULL,
6032 NULL,
6033 g_cclosure_marshal_generic,
6034 G_TYPE_NONE,
6035 0);
6036
6037 /* GObject properties for D-Bus properties: */
6038 /**
6039 * SensorThreshold:lower-critical:
6040 *
6041 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6042 *
6043 * 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.
6044 */
6045 g_object_interface_install_property (iface,
6046 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6047 /**
6048 * SensorThreshold:lower-warning:
6049 *
6050 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6051 *
6052 * 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.
6053 */
6054 g_object_interface_install_property (iface,
6055 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6056 /**
6057 * SensorThreshold:upper-warning:
6058 *
6059 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6060 *
6061 * 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.
6062 */
6063 g_object_interface_install_property (iface,
6064 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6065 /**
6066 * SensorThreshold:upper-critical:
6067 *
6068 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6069 *
6070 * 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.
6071 */
6072 g_object_interface_install_property (iface,
6073 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6074 /**
6075 * SensorThreshold:state:
6076 *
6077 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6078 *
6079 * 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.
6080 */
6081 g_object_interface_install_property (iface,
6082 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6083}
6084
6085/**
6086 * sensor_threshold_get_lower_critical: (skip)
6087 * @object: A #SensorThreshold.
6088 *
6089 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6090 *
6091 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6092 *
6093 * <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>
6094 *
6095 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6096 */
6097GVariant *
6098sensor_threshold_get_lower_critical (SensorThreshold *object)
6099{
6100 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6101}
6102
6103/**
6104 * sensor_threshold_dup_lower_critical: (skip)
6105 * @object: A #SensorThreshold.
6106 *
6107 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6108 *
6109 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6110 *
6111 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6112 */
6113GVariant *
6114sensor_threshold_dup_lower_critical (SensorThreshold *object)
6115{
6116 GVariant *value;
6117 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6118 return value;
6119}
6120
6121/**
6122 * sensor_threshold_set_lower_critical: (skip)
6123 * @object: A #SensorThreshold.
6124 * @value: The value to set.
6125 *
6126 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6127 *
6128 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6129 */
6130void
6131sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6132{
6133 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6134}
6135
6136/**
6137 * sensor_threshold_get_lower_warning: (skip)
6138 * @object: A #SensorThreshold.
6139 *
6140 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6141 *
6142 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6143 *
6144 * <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>
6145 *
6146 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6147 */
6148GVariant *
6149sensor_threshold_get_lower_warning (SensorThreshold *object)
6150{
6151 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6152}
6153
6154/**
6155 * sensor_threshold_dup_lower_warning: (skip)
6156 * @object: A #SensorThreshold.
6157 *
6158 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6159 *
6160 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6161 *
6162 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6163 */
6164GVariant *
6165sensor_threshold_dup_lower_warning (SensorThreshold *object)
6166{
6167 GVariant *value;
6168 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6169 return value;
6170}
6171
6172/**
6173 * sensor_threshold_set_lower_warning: (skip)
6174 * @object: A #SensorThreshold.
6175 * @value: The value to set.
6176 *
6177 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6178 *
6179 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6180 */
6181void
6182sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6183{
6184 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6185}
6186
6187/**
6188 * sensor_threshold_get_upper_warning: (skip)
6189 * @object: A #SensorThreshold.
6190 *
6191 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6192 *
6193 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6194 *
6195 * <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>
6196 *
6197 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6198 */
6199GVariant *
6200sensor_threshold_get_upper_warning (SensorThreshold *object)
6201{
6202 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6203}
6204
6205/**
6206 * sensor_threshold_dup_upper_warning: (skip)
6207 * @object: A #SensorThreshold.
6208 *
6209 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6210 *
6211 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6212 *
6213 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6214 */
6215GVariant *
6216sensor_threshold_dup_upper_warning (SensorThreshold *object)
6217{
6218 GVariant *value;
6219 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6220 return value;
6221}
6222
6223/**
6224 * sensor_threshold_set_upper_warning: (skip)
6225 * @object: A #SensorThreshold.
6226 * @value: The value to set.
6227 *
6228 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6229 *
6230 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6231 */
6232void
6233sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6234{
6235 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6236}
6237
6238/**
6239 * sensor_threshold_get_upper_critical: (skip)
6240 * @object: A #SensorThreshold.
6241 *
6242 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6243 *
6244 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6245 *
6246 * <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>
6247 *
6248 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6249 */
6250GVariant *
6251sensor_threshold_get_upper_critical (SensorThreshold *object)
6252{
6253 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6254}
6255
6256/**
6257 * sensor_threshold_dup_upper_critical: (skip)
6258 * @object: A #SensorThreshold.
6259 *
6260 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6261 *
6262 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6263 *
6264 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6265 */
6266GVariant *
6267sensor_threshold_dup_upper_critical (SensorThreshold *object)
6268{
6269 GVariant *value;
6270 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6271 return value;
6272}
6273
6274/**
6275 * sensor_threshold_set_upper_critical: (skip)
6276 * @object: A #SensorThreshold.
6277 * @value: The value to set.
6278 *
6279 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6280 *
6281 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6282 */
6283void
6284sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6285{
6286 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6287}
6288
6289/**
6290 * sensor_threshold_get_state: (skip)
6291 * @object: A #SensorThreshold.
6292 *
6293 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6294 *
6295 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6296 *
6297 * Returns: The property value.
6298 */
6299guchar
6300sensor_threshold_get_state (SensorThreshold *object)
6301{
6302 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6303}
6304
6305/**
6306 * sensor_threshold_set_state: (skip)
6307 * @object: A #SensorThreshold.
6308 * @value: The value to set.
6309 *
6310 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6311 *
6312 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6313 */
6314void
6315sensor_threshold_set_state (SensorThreshold *object, guchar value)
6316{
6317 g_object_set (G_OBJECT (object), "state", value, NULL);
6318}
6319
6320/**
6321 * sensor_threshold_emit_warning:
6322 * @object: A #SensorThreshold.
6323 *
6324 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6325 */
6326void
6327sensor_threshold_emit_warning (
6328 SensorThreshold *object)
6329{
6330 g_signal_emit_by_name (object, "warning");
6331}
6332
6333/**
6334 * sensor_threshold_emit_critical:
6335 * @object: A #SensorThreshold.
6336 *
6337 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6338 */
6339void
6340sensor_threshold_emit_critical (
6341 SensorThreshold *object)
6342{
6343 g_signal_emit_by_name (object, "critical");
6344}
6345
6346/**
6347 * sensor_threshold_emit_normal:
6348 * @object: A #SensorThreshold.
6349 *
6350 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6351 */
6352void
6353sensor_threshold_emit_normal (
6354 SensorThreshold *object)
6355{
6356 g_signal_emit_by_name (object, "normal");
6357}
6358
6359/**
6360 * sensor_threshold_call_get_state:
6361 * @proxy: A #SensorThresholdProxy.
6362 * @cancellable: (allow-none): A #GCancellable or %NULL.
6363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6364 * @user_data: User data to pass to @callback.
6365 *
6366 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6367 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6368 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6369 *
6370 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6371 */
6372void
6373sensor_threshold_call_get_state (
6374 SensorThreshold *proxy,
6375 GCancellable *cancellable,
6376 GAsyncReadyCallback callback,
6377 gpointer user_data)
6378{
6379 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6380 "getState",
6381 g_variant_new ("()"),
6382 G_DBUS_CALL_FLAGS_NONE,
6383 -1,
6384 cancellable,
6385 callback,
6386 user_data);
6387}
6388
6389/**
6390 * sensor_threshold_call_get_state_finish:
6391 * @proxy: A #SensorThresholdProxy.
6392 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6393 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6394 * @error: Return location for error or %NULL.
6395 *
6396 * Finishes an operation started with sensor_threshold_call_get_state().
6397 *
6398 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6399 */
6400gboolean
6401sensor_threshold_call_get_state_finish (
6402 SensorThreshold *proxy,
6403 guchar *out_state,
6404 GAsyncResult *res,
6405 GError **error)
6406{
6407 GVariant *_ret;
6408 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6409 if (_ret == NULL)
6410 goto _out;
6411 g_variant_get (_ret,
6412 "(y)",
6413 out_state);
6414 g_variant_unref (_ret);
6415_out:
6416 return _ret != NULL;
6417}
6418
6419/**
6420 * sensor_threshold_call_get_state_sync:
6421 * @proxy: A #SensorThresholdProxy.
6422 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6423 * @cancellable: (allow-none): A #GCancellable or %NULL.
6424 * @error: Return location for error or %NULL.
6425 *
6426 * 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.
6427 *
6428 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6429 *
6430 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6431 */
6432gboolean
6433sensor_threshold_call_get_state_sync (
6434 SensorThreshold *proxy,
6435 guchar *out_state,
6436 GCancellable *cancellable,
6437 GError **error)
6438{
6439 GVariant *_ret;
6440 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6441 "getState",
6442 g_variant_new ("()"),
6443 G_DBUS_CALL_FLAGS_NONE,
6444 -1,
6445 cancellable,
6446 error);
6447 if (_ret == NULL)
6448 goto _out;
6449 g_variant_get (_ret,
6450 "(y)",
6451 out_state);
6452 g_variant_unref (_ret);
6453_out:
6454 return _ret != NULL;
6455}
6456
6457/**
6458 * sensor_threshold_complete_get_state:
6459 * @object: A #SensorThreshold.
6460 * @invocation: (transfer full): A #GDBusMethodInvocation.
6461 * @state: Parameter to return.
6462 *
6463 * 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.
6464 *
6465 * This method will free @invocation, you cannot use it afterwards.
6466 */
6467void
6468sensor_threshold_complete_get_state (
6469 SensorThreshold *object,
6470 GDBusMethodInvocation *invocation,
6471 guchar state)
6472{
6473 g_dbus_method_invocation_return_value (invocation,
6474 g_variant_new ("(y)",
6475 state));
6476}
6477
6478/* ------------------------------------------------------------------------ */
6479
6480/**
6481 * SensorThresholdProxy:
6482 *
6483 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6484 */
6485
6486/**
6487 * SensorThresholdProxyClass:
6488 * @parent_class: The parent class.
6489 *
6490 * Class structure for #SensorThresholdProxy.
6491 */
6492
6493struct _SensorThresholdProxyPrivate
6494{
6495 GData *qdata;
6496};
6497
6498static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6499
6500#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6501G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6502 G_ADD_PRIVATE (SensorThresholdProxy)
6503 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6504
6505#else
6506G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6507 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6508
6509#endif
6510static void
6511sensor_threshold_proxy_finalize (GObject *object)
6512{
6513 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6514 g_datalist_clear (&proxy->priv->qdata);
6515 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6516}
6517
6518static void
6519sensor_threshold_proxy_get_property (GObject *object,
6520 guint prop_id,
6521 GValue *value,
6522 GParamSpec *pspec G_GNUC_UNUSED)
6523{
6524 const _ExtendedGDBusPropertyInfo *info;
6525 GVariant *variant;
6526 g_assert (prop_id != 0 && prop_id - 1 < 5);
6527 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6528 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6529 if (info->use_gvariant)
6530 {
6531 g_value_set_variant (value, variant);
6532 }
6533 else
6534 {
6535 if (variant != NULL)
6536 g_dbus_gvariant_to_gvalue (variant, value);
6537 }
6538 if (variant != NULL)
6539 g_variant_unref (variant);
6540}
6541
6542static void
6543sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6544 GAsyncResult *res,
6545 gpointer user_data)
6546{
6547 const _ExtendedGDBusPropertyInfo *info = user_data;
6548 GError *error;
6549 GVariant *_ret;
6550 error = NULL;
6551 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6552 if (!_ret)
6553 {
6554 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6555 info->parent_struct.name,
6556 error->message, g_quark_to_string (error->domain), error->code);
6557 g_error_free (error);
6558 }
6559 else
6560 {
6561 g_variant_unref (_ret);
6562 }
6563}
6564
6565static void
6566sensor_threshold_proxy_set_property (GObject *object,
6567 guint prop_id,
6568 const GValue *value,
6569 GParamSpec *pspec G_GNUC_UNUSED)
6570{
6571 const _ExtendedGDBusPropertyInfo *info;
6572 GVariant *variant;
6573 g_assert (prop_id != 0 && prop_id - 1 < 5);
6574 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6575 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6576 g_dbus_proxy_call (G_DBUS_PROXY (object),
6577 "org.freedesktop.DBus.Properties.Set",
6578 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6579 G_DBUS_CALL_FLAGS_NONE,
6580 -1,
6581 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6582 g_variant_unref (variant);
6583}
6584
6585static void
6586sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6587 const gchar *sender_name G_GNUC_UNUSED,
6588 const gchar *signal_name,
6589 GVariant *parameters)
6590{
6591 _ExtendedGDBusSignalInfo *info;
6592 GVariantIter iter;
6593 GVariant *child;
6594 GValue *paramv;
6595 guint num_params;
6596 guint n;
6597 guint signal_id;
6598 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6599 if (info == NULL)
6600 return;
6601 num_params = g_variant_n_children (parameters);
6602 paramv = g_new0 (GValue, num_params + 1);
6603 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6604 g_value_set_object (&paramv[0], proxy);
6605 g_variant_iter_init (&iter, parameters);
6606 n = 1;
6607 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6608 {
6609 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6610 if (arg_info->use_gvariant)
6611 {
6612 g_value_init (&paramv[n], G_TYPE_VARIANT);
6613 g_value_set_variant (&paramv[n], child);
6614 n++;
6615 }
6616 else
6617 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6618 g_variant_unref (child);
6619 }
6620 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6621 g_signal_emitv (paramv, signal_id, 0, NULL);
6622 for (n = 0; n < num_params + 1; n++)
6623 g_value_unset (&paramv[n]);
6624 g_free (paramv);
6625}
6626
6627static void
6628sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6629 GVariant *changed_properties,
6630 const gchar *const *invalidated_properties)
6631{
6632 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6633 guint n;
6634 const gchar *key;
6635 GVariantIter *iter;
6636 _ExtendedGDBusPropertyInfo *info;
6637 g_variant_get (changed_properties, "a{sv}", &iter);
6638 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6639 {
6640 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6641 g_datalist_remove_data (&proxy->priv->qdata, key);
6642 if (info != NULL)
6643 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6644 }
6645 g_variant_iter_free (iter);
6646 for (n = 0; invalidated_properties[n] != NULL; n++)
6647 {
6648 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6649 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6650 if (info != NULL)
6651 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6652 }
6653}
6654
6655static GVariant *
6656sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6657{
6658 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6659 GVariant *variant;
6660 GVariant *value = NULL;
6661 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6662 value = variant;
6663 if (variant != NULL)
6664 g_variant_unref (variant);
6665 return value;
6666}
6667
6668static GVariant *
6669sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6670{
6671 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6672 GVariant *variant;
6673 GVariant *value = NULL;
6674 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6675 value = variant;
6676 if (variant != NULL)
6677 g_variant_unref (variant);
6678 return value;
6679}
6680
6681static GVariant *
6682sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6683{
6684 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6685 GVariant *variant;
6686 GVariant *value = NULL;
6687 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6688 value = variant;
6689 if (variant != NULL)
6690 g_variant_unref (variant);
6691 return value;
6692}
6693
6694static GVariant *
6695sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6696{
6697 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6698 GVariant *variant;
6699 GVariant *value = NULL;
6700 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6701 value = variant;
6702 if (variant != NULL)
6703 g_variant_unref (variant);
6704 return value;
6705}
6706
6707static guchar
6708sensor_threshold_proxy_get_state (SensorThreshold *object)
6709{
6710 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6711 GVariant *variant;
6712 guchar value = 0;
6713 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6714 if (variant != NULL)
6715 {
6716 value = g_variant_get_byte (variant);
6717 g_variant_unref (variant);
6718 }
6719 return value;
6720}
6721
6722static void
6723sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6724{
6725#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6726 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6727#else
6728 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6729#endif
6730
6731 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6732}
6733
6734static void
6735sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6736{
6737 GObjectClass *gobject_class;
6738 GDBusProxyClass *proxy_class;
6739
6740 gobject_class = G_OBJECT_CLASS (klass);
6741 gobject_class->finalize = sensor_threshold_proxy_finalize;
6742 gobject_class->get_property = sensor_threshold_proxy_get_property;
6743 gobject_class->set_property = sensor_threshold_proxy_set_property;
6744
6745 proxy_class = G_DBUS_PROXY_CLASS (klass);
6746 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6747 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6748
6749 sensor_threshold_override_properties (gobject_class, 1);
6750
6751#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6752 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6753#endif
6754}
6755
6756static void
6757sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6758{
6759 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6760 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6761 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6762 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6763 iface->get_state = sensor_threshold_proxy_get_state;
6764}
6765
6766/**
6767 * sensor_threshold_proxy_new:
6768 * @connection: A #GDBusConnection.
6769 * @flags: Flags from the #GDBusProxyFlags enumeration.
6770 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6771 * @object_path: An object path.
6772 * @cancellable: (allow-none): A #GCancellable or %NULL.
6773 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6774 * @user_data: User data to pass to @callback.
6775 *
6776 * 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.
6777 *
6778 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6779 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6780 *
6781 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6782 */
6783void
6784sensor_threshold_proxy_new (
6785 GDBusConnection *connection,
6786 GDBusProxyFlags flags,
6787 const gchar *name,
6788 const gchar *object_path,
6789 GCancellable *cancellable,
6790 GAsyncReadyCallback callback,
6791 gpointer user_data)
6792{
6793 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);
6794}
6795
6796/**
6797 * sensor_threshold_proxy_new_finish:
6798 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6799 * @error: Return location for error or %NULL
6800 *
6801 * Finishes an operation started with sensor_threshold_proxy_new().
6802 *
6803 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6804 */
6805SensorThreshold *
6806sensor_threshold_proxy_new_finish (
6807 GAsyncResult *res,
6808 GError **error)
6809{
6810 GObject *ret;
6811 GObject *source_object;
6812 source_object = g_async_result_get_source_object (res);
6813 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6814 g_object_unref (source_object);
6815 if (ret != NULL)
6816 return SENSOR_THRESHOLD (ret);
6817 else
6818 return NULL;
6819}
6820
6821/**
6822 * sensor_threshold_proxy_new_sync:
6823 * @connection: A #GDBusConnection.
6824 * @flags: Flags from the #GDBusProxyFlags enumeration.
6825 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6826 * @object_path: An object path.
6827 * @cancellable: (allow-none): A #GCancellable or %NULL.
6828 * @error: Return location for error or %NULL
6829 *
6830 * 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.
6831 *
6832 * The calling thread is blocked until a reply is received.
6833 *
6834 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
6835 *
6836 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6837 */
6838SensorThreshold *
6839sensor_threshold_proxy_new_sync (
6840 GDBusConnection *connection,
6841 GDBusProxyFlags flags,
6842 const gchar *name,
6843 const gchar *object_path,
6844 GCancellable *cancellable,
6845 GError **error)
6846{
6847 GInitable *ret;
6848 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);
6849 if (ret != NULL)
6850 return SENSOR_THRESHOLD (ret);
6851 else
6852 return NULL;
6853}
6854
6855
6856/**
6857 * sensor_threshold_proxy_new_for_bus:
6858 * @bus_type: A #GBusType.
6859 * @flags: Flags from the #GDBusProxyFlags enumeration.
6860 * @name: A bus name (well-known or unique).
6861 * @object_path: An object path.
6862 * @cancellable: (allow-none): A #GCancellable or %NULL.
6863 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6864 * @user_data: User data to pass to @callback.
6865 *
6866 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6867 *
6868 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6869 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
6870 *
6871 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6872 */
6873void
6874sensor_threshold_proxy_new_for_bus (
6875 GBusType bus_type,
6876 GDBusProxyFlags flags,
6877 const gchar *name,
6878 const gchar *object_path,
6879 GCancellable *cancellable,
6880 GAsyncReadyCallback callback,
6881 gpointer user_data)
6882{
6883 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);
6884}
6885
6886/**
6887 * sensor_threshold_proxy_new_for_bus_finish:
6888 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
6889 * @error: Return location for error or %NULL
6890 *
6891 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
6892 *
6893 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6894 */
6895SensorThreshold *
6896sensor_threshold_proxy_new_for_bus_finish (
6897 GAsyncResult *res,
6898 GError **error)
6899{
6900 GObject *ret;
6901 GObject *source_object;
6902 source_object = g_async_result_get_source_object (res);
6903 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6904 g_object_unref (source_object);
6905 if (ret != NULL)
6906 return SENSOR_THRESHOLD (ret);
6907 else
6908 return NULL;
6909}
6910
6911/**
6912 * sensor_threshold_proxy_new_for_bus_sync:
6913 * @bus_type: A #GBusType.
6914 * @flags: Flags from the #GDBusProxyFlags enumeration.
6915 * @name: A bus name (well-known or unique).
6916 * @object_path: An object path.
6917 * @cancellable: (allow-none): A #GCancellable or %NULL.
6918 * @error: Return location for error or %NULL
6919 *
6920 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6921 *
6922 * The calling thread is blocked until a reply is received.
6923 *
6924 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
6925 *
6926 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6927 */
6928SensorThreshold *
6929sensor_threshold_proxy_new_for_bus_sync (
6930 GBusType bus_type,
6931 GDBusProxyFlags flags,
6932 const gchar *name,
6933 const gchar *object_path,
6934 GCancellable *cancellable,
6935 GError **error)
6936{
6937 GInitable *ret;
6938 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);
6939 if (ret != NULL)
6940 return SENSOR_THRESHOLD (ret);
6941 else
6942 return NULL;
6943}
6944
6945
6946/* ------------------------------------------------------------------------ */
6947
6948/**
6949 * SensorThresholdSkeleton:
6950 *
6951 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
6952 */
6953
6954/**
6955 * SensorThresholdSkeletonClass:
6956 * @parent_class: The parent class.
6957 *
6958 * Class structure for #SensorThresholdSkeleton.
6959 */
6960
6961struct _SensorThresholdSkeletonPrivate
6962{
6963 GValue *properties;
6964 GList *changed_properties;
6965 GSource *changed_properties_idle_source;
6966 GMainContext *context;
6967 GMutex lock;
6968};
6969
6970static void
6971_sensor_threshold_skeleton_handle_method_call (
6972 GDBusConnection *connection G_GNUC_UNUSED,
6973 const gchar *sender G_GNUC_UNUSED,
6974 const gchar *object_path G_GNUC_UNUSED,
6975 const gchar *interface_name,
6976 const gchar *method_name,
6977 GVariant *parameters,
6978 GDBusMethodInvocation *invocation,
6979 gpointer user_data)
6980{
6981 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6982 _ExtendedGDBusMethodInfo *info;
6983 GVariantIter iter;
6984 GVariant *child;
6985 GValue *paramv;
6986 guint num_params;
6987 guint num_extra;
6988 guint n;
6989 guint signal_id;
6990 GValue return_value = G_VALUE_INIT;
6991 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6992 g_assert (info != NULL);
6993 num_params = g_variant_n_children (parameters);
6994 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6995 n = 0;
6996 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
6997 g_value_set_object (&paramv[n++], skeleton);
6998 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6999 g_value_set_object (&paramv[n++], invocation);
7000 if (info->pass_fdlist)
7001 {
7002#ifdef G_OS_UNIX
7003 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7004 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7005#else
7006 g_assert_not_reached ();
7007#endif
7008 }
7009 g_variant_iter_init (&iter, parameters);
7010 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7011 {
7012 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7013 if (arg_info->use_gvariant)
7014 {
7015 g_value_init (&paramv[n], G_TYPE_VARIANT);
7016 g_value_set_variant (&paramv[n], child);
7017 n++;
7018 }
7019 else
7020 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7021 g_variant_unref (child);
7022 }
7023 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7024 g_value_init (&return_value, G_TYPE_BOOLEAN);
7025 g_signal_emitv (paramv, signal_id, 0, &return_value);
7026 if (!g_value_get_boolean (&return_value))
7027 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);
7028 g_value_unset (&return_value);
7029 for (n = 0; n < num_params + num_extra; n++)
7030 g_value_unset (&paramv[n]);
7031 g_free (paramv);
7032}
7033
7034static GVariant *
7035_sensor_threshold_skeleton_handle_get_property (
7036 GDBusConnection *connection G_GNUC_UNUSED,
7037 const gchar *sender G_GNUC_UNUSED,
7038 const gchar *object_path G_GNUC_UNUSED,
7039 const gchar *interface_name G_GNUC_UNUSED,
7040 const gchar *property_name,
7041 GError **error,
7042 gpointer user_data)
7043{
7044 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7045 GValue value = G_VALUE_INIT;
7046 GParamSpec *pspec;
7047 _ExtendedGDBusPropertyInfo *info;
7048 GVariant *ret;
7049 ret = NULL;
7050 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7051 g_assert (info != NULL);
7052 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7053 if (pspec == NULL)
7054 {
7055 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7056 }
7057 else
7058 {
7059 g_value_init (&value, pspec->value_type);
7060 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7061 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7062 g_value_unset (&value);
7063 }
7064 return ret;
7065}
7066
7067static gboolean
7068_sensor_threshold_skeleton_handle_set_property (
7069 GDBusConnection *connection G_GNUC_UNUSED,
7070 const gchar *sender G_GNUC_UNUSED,
7071 const gchar *object_path G_GNUC_UNUSED,
7072 const gchar *interface_name G_GNUC_UNUSED,
7073 const gchar *property_name,
7074 GVariant *variant,
7075 GError **error,
7076 gpointer user_data)
7077{
7078 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7079 GValue value = G_VALUE_INIT;
7080 GParamSpec *pspec;
7081 _ExtendedGDBusPropertyInfo *info;
7082 gboolean ret;
7083 ret = FALSE;
7084 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7085 g_assert (info != NULL);
7086 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7087 if (pspec == NULL)
7088 {
7089 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7090 }
7091 else
7092 {
7093 if (info->use_gvariant)
7094 g_value_set_variant (&value, variant);
7095 else
7096 g_dbus_gvariant_to_gvalue (variant, &value);
7097 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7098 g_value_unset (&value);
7099 ret = TRUE;
7100 }
7101 return ret;
7102}
7103
7104static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7105{
7106 _sensor_threshold_skeleton_handle_method_call,
7107 _sensor_threshold_skeleton_handle_get_property,
7108 _sensor_threshold_skeleton_handle_set_property,
7109 {NULL}
7110};
7111
7112static GDBusInterfaceInfo *
7113sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7114{
7115 return sensor_threshold_interface_info ();
7116}
7117
7118static GDBusInterfaceVTable *
7119sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7120{
7121 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7122}
7123
7124static GVariant *
7125sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7126{
7127 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7128
7129 GVariantBuilder builder;
7130 guint n;
7131 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7132 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7133 goto out;
7134 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7135 {
7136 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7137 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7138 {
7139 GVariant *value;
7140 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);
7141 if (value != NULL)
7142 {
7143 g_variant_take_ref (value);
7144 g_variant_builder_add (&builder, "{sv}", info->name, value);
7145 g_variant_unref (value);
7146 }
7147 }
7148 }
7149out:
7150 return g_variant_builder_end (&builder);
7151}
7152
7153static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7154
7155static void
7156sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7157{
7158 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7159 gboolean emit_changed = FALSE;
7160
7161 g_mutex_lock (&skeleton->priv->lock);
7162 if (skeleton->priv->changed_properties_idle_source != NULL)
7163 {
7164 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7165 skeleton->priv->changed_properties_idle_source = NULL;
7166 emit_changed = TRUE;
7167 }
7168 g_mutex_unlock (&skeleton->priv->lock);
7169
7170 if (emit_changed)
7171 _sensor_threshold_emit_changed (skeleton);
7172}
7173
7174static void
7175_sensor_threshold_on_signal_warning (
7176 SensorThreshold *object)
7177{
7178 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7179
7180 GList *connections, *l;
7181 GVariant *signal_variant;
7182 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7183
7184 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7185 for (l = connections; l != NULL; l = l->next)
7186 {
7187 GDBusConnection *connection = l->data;
7188 g_dbus_connection_emit_signal (connection,
7189 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7190 signal_variant, NULL);
7191 }
7192 g_variant_unref (signal_variant);
7193 g_list_free_full (connections, g_object_unref);
7194}
7195
7196static void
7197_sensor_threshold_on_signal_critical (
7198 SensorThreshold *object)
7199{
7200 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7201
7202 GList *connections, *l;
7203 GVariant *signal_variant;
7204 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7205
7206 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7207 for (l = connections; l != NULL; l = l->next)
7208 {
7209 GDBusConnection *connection = l->data;
7210 g_dbus_connection_emit_signal (connection,
7211 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7212 signal_variant, NULL);
7213 }
7214 g_variant_unref (signal_variant);
7215 g_list_free_full (connections, g_object_unref);
7216}
7217
7218static void
7219_sensor_threshold_on_signal_normal (
7220 SensorThreshold *object)
7221{
7222 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7223
7224 GList *connections, *l;
7225 GVariant *signal_variant;
7226 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7227
7228 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7229 for (l = connections; l != NULL; l = l->next)
7230 {
7231 GDBusConnection *connection = l->data;
7232 g_dbus_connection_emit_signal (connection,
7233 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7234 signal_variant, NULL);
7235 }
7236 g_variant_unref (signal_variant);
7237 g_list_free_full (connections, g_object_unref);
7238}
7239
7240static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7241#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7242G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7243 G_ADD_PRIVATE (SensorThresholdSkeleton)
7244 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7245
7246#else
7247G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7248 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7249
7250#endif
7251static void
7252sensor_threshold_skeleton_finalize (GObject *object)
7253{
7254 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7255 guint n;
7256 for (n = 0; n < 5; n++)
7257 g_value_unset (&skeleton->priv->properties[n]);
7258 g_free (skeleton->priv->properties);
7259 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7260 if (skeleton->priv->changed_properties_idle_source != NULL)
7261 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7262 g_main_context_unref (skeleton->priv->context);
7263 g_mutex_clear (&skeleton->priv->lock);
7264 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7265}
7266
7267static void
7268sensor_threshold_skeleton_get_property (GObject *object,
7269 guint prop_id,
7270 GValue *value,
7271 GParamSpec *pspec G_GNUC_UNUSED)
7272{
7273 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7274 g_assert (prop_id != 0 && prop_id - 1 < 5);
7275 g_mutex_lock (&skeleton->priv->lock);
7276 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7277 g_mutex_unlock (&skeleton->priv->lock);
7278}
7279
7280static gboolean
7281_sensor_threshold_emit_changed (gpointer user_data)
7282{
7283 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7284 GList *l;
7285 GVariantBuilder builder;
7286 GVariantBuilder invalidated_builder;
7287 guint num_changes;
7288
7289 g_mutex_lock (&skeleton->priv->lock);
7290 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7291 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7292 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7293 {
7294 ChangedProperty *cp = l->data;
7295 GVariant *variant;
7296 const GValue *cur_value;
7297
7298 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7299 if (!_g_value_equal (cur_value, &cp->orig_value))
7300 {
7301 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7302 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7303 g_variant_unref (variant);
7304 num_changes++;
7305 }
7306 }
7307 if (num_changes > 0)
7308 {
7309 GList *connections, *ll;
7310 GVariant *signal_variant;
7311 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7312 &builder, &invalidated_builder));
7313 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7314 for (ll = connections; ll != NULL; ll = ll->next)
7315 {
7316 GDBusConnection *connection = ll->data;
7317
7318 g_dbus_connection_emit_signal (connection,
7319 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7320 "org.freedesktop.DBus.Properties",
7321 "PropertiesChanged",
7322 signal_variant,
7323 NULL);
7324 }
7325 g_variant_unref (signal_variant);
7326 g_list_free_full (connections, g_object_unref);
7327 }
7328 else
7329 {
7330 g_variant_builder_clear (&builder);
7331 g_variant_builder_clear (&invalidated_builder);
7332 }
7333 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7334 skeleton->priv->changed_properties = NULL;
7335 skeleton->priv->changed_properties_idle_source = NULL;
7336 g_mutex_unlock (&skeleton->priv->lock);
7337 return FALSE;
7338}
7339
7340static void
7341_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7342{
7343 ChangedProperty *cp;
7344 GList *l;
7345 cp = NULL;
7346 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7347 {
7348 ChangedProperty *i_cp = l->data;
7349 if (i_cp->info == info)
7350 {
7351 cp = i_cp;
7352 break;
7353 }
7354 }
7355 if (cp == NULL)
7356 {
7357 cp = g_new0 (ChangedProperty, 1);
7358 cp->prop_id = prop_id;
7359 cp->info = info;
7360 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7361 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7362 g_value_copy (orig_value, &cp->orig_value);
7363 }
7364}
7365
7366static void
7367sensor_threshold_skeleton_notify (GObject *object,
7368 GParamSpec *pspec G_GNUC_UNUSED)
7369{
7370 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7371 g_mutex_lock (&skeleton->priv->lock);
7372 if (skeleton->priv->changed_properties != NULL &&
7373 skeleton->priv->changed_properties_idle_source == NULL)
7374 {
7375 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7376 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7377 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7378 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7379 g_source_unref (skeleton->priv->changed_properties_idle_source);
7380 }
7381 g_mutex_unlock (&skeleton->priv->lock);
7382}
7383
7384static void
7385sensor_threshold_skeleton_set_property (GObject *object,
7386 guint prop_id,
7387 const GValue *value,
7388 GParamSpec *pspec)
7389{
7390 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7391 g_assert (prop_id != 0 && prop_id - 1 < 5);
7392 g_mutex_lock (&skeleton->priv->lock);
7393 g_object_freeze_notify (object);
7394 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7395 {
7396 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7397 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7398 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7399 g_object_notify_by_pspec (object, pspec);
7400 }
7401 g_mutex_unlock (&skeleton->priv->lock);
7402 g_object_thaw_notify (object);
7403}
7404
7405static void
7406sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7407{
7408#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7409 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7410#else
7411 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7412#endif
7413
7414 g_mutex_init (&skeleton->priv->lock);
7415 skeleton->priv->context = g_main_context_ref_thread_default ();
7416 skeleton->priv->properties = g_new0 (GValue, 5);
7417 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7418 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7419 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7420 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7421 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7422}
7423
7424static GVariant *
7425sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7426{
7427 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7428 GVariant *value;
7429 g_mutex_lock (&skeleton->priv->lock);
7430 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7431 g_mutex_unlock (&skeleton->priv->lock);
7432 return value;
7433}
7434
7435static GVariant *
7436sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7437{
7438 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7439 GVariant *value;
7440 g_mutex_lock (&skeleton->priv->lock);
7441 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7442 g_mutex_unlock (&skeleton->priv->lock);
7443 return value;
7444}
7445
7446static GVariant *
7447sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7448{
7449 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7450 GVariant *value;
7451 g_mutex_lock (&skeleton->priv->lock);
7452 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7453 g_mutex_unlock (&skeleton->priv->lock);
7454 return value;
7455}
7456
7457static GVariant *
7458sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7459{
7460 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7461 GVariant *value;
7462 g_mutex_lock (&skeleton->priv->lock);
7463 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7464 g_mutex_unlock (&skeleton->priv->lock);
7465 return value;
7466}
7467
7468static guchar
7469sensor_threshold_skeleton_get_state (SensorThreshold *object)
7470{
7471 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7472 guchar value;
7473 g_mutex_lock (&skeleton->priv->lock);
7474 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7475 g_mutex_unlock (&skeleton->priv->lock);
7476 return value;
7477}
7478
7479static void
7480sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7481{
7482 GObjectClass *gobject_class;
7483 GDBusInterfaceSkeletonClass *skeleton_class;
7484
7485 gobject_class = G_OBJECT_CLASS (klass);
7486 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7487 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7488 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7489 gobject_class->notify = sensor_threshold_skeleton_notify;
7490
7491
7492 sensor_threshold_override_properties (gobject_class, 1);
7493
7494 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7495 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7496 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7497 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7498 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7499
7500#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7501 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7502#endif
7503}
7504
7505static void
7506sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7507{
7508 iface->warning = _sensor_threshold_on_signal_warning;
7509 iface->critical = _sensor_threshold_on_signal_critical;
7510 iface->normal = _sensor_threshold_on_signal_normal;
7511 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7512 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7513 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7514 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7515 iface->get_state = sensor_threshold_skeleton_get_state;
7516}
7517
7518/**
7519 * sensor_threshold_skeleton_new:
7520 *
7521 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7522 *
7523 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7524 */
7525SensorThreshold *
7526sensor_threshold_skeleton_new (void)
7527{
7528 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7529}
7530
7531/* ------------------------------------------------------------------------
7532 * Code for interface org.openbmc.SensorI2c
7533 * ------------------------------------------------------------------------
7534 */
7535
7536/**
7537 * SECTION:SensorI2c
7538 * @title: SensorI2c
7539 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7540 *
7541 * 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.
7542 */
7543
7544/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7545
7546static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7547{
7548 {
7549 -1,
7550 (gchar *) "dev_path",
7551 (gchar *) "s",
7552 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7553 NULL
7554 },
7555 "dev-path",
7556 FALSE
7557};
7558
7559static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7560{
7561 {
7562 -1,
7563 (gchar *) "address",
7564 (gchar *) "s",
7565 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7566 NULL
7567 },
7568 "address",
7569 FALSE
7570};
7571
7572static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7573{
7574 &_sensor_i2c_property_info_dev_path,
7575 &_sensor_i2c_property_info_address,
7576 NULL
7577};
7578
7579static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7580{
7581 {
7582 -1,
7583 (gchar *) "org.openbmc.SensorI2c",
7584 NULL,
7585 NULL,
7586 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7587 NULL
7588 },
7589 "sensor-i2c",
7590};
7591
7592
7593/**
7594 * sensor_i2c_interface_info:
7595 *
7596 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7597 *
7598 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7599 */
7600GDBusInterfaceInfo *
7601sensor_i2c_interface_info (void)
7602{
7603 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7604}
7605
7606/**
7607 * sensor_i2c_override_properties:
7608 * @klass: The class structure for a #GObject<!-- -->-derived class.
7609 * @property_id_begin: The property id to assign to the first overridden property.
7610 *
7611 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7612 * The properties are overridden in the order they are defined.
7613 *
7614 * Returns: The last property id.
7615 */
7616guint
7617sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7618{
7619 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7620 g_object_class_override_property (klass, property_id_begin++, "address");
7621 return property_id_begin - 1;
7622}
7623
7624
7625
7626/**
7627 * SensorI2c:
7628 *
7629 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7630 */
7631
7632/**
7633 * SensorI2cIface:
7634 * @parent_iface: The parent interface.
7635 * @get_address: Getter for the #SensorI2c:address property.
7636 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7637 *
7638 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7639 */
7640
7641typedef SensorI2cIface SensorI2cInterface;
7642G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7643
7644static void
7645sensor_i2c_default_init (SensorI2cIface *iface)
7646{
7647 /* GObject properties for D-Bus properties: */
7648 /**
7649 * SensorI2c:dev-path:
7650 *
7651 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7652 *
7653 * 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.
7654 */
7655 g_object_interface_install_property (iface,
7656 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7657 /**
7658 * SensorI2c:address:
7659 *
7660 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7661 *
7662 * 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.
7663 */
7664 g_object_interface_install_property (iface,
7665 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7666}
7667
7668/**
7669 * sensor_i2c_get_dev_path: (skip)
7670 * @object: A #SensorI2c.
7671 *
7672 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7673 *
7674 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7675 *
7676 * <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>
7677 *
7678 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7679 */
7680const gchar *
7681sensor_i2c_get_dev_path (SensorI2c *object)
7682{
7683 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7684}
7685
7686/**
7687 * sensor_i2c_dup_dev_path: (skip)
7688 * @object: A #SensorI2c.
7689 *
7690 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7691 *
7692 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7693 *
7694 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7695 */
7696gchar *
7697sensor_i2c_dup_dev_path (SensorI2c *object)
7698{
7699 gchar *value;
7700 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7701 return value;
7702}
7703
7704/**
7705 * sensor_i2c_set_dev_path: (skip)
7706 * @object: A #SensorI2c.
7707 * @value: The value to set.
7708 *
7709 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7710 *
7711 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7712 */
7713void
7714sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7715{
7716 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7717}
7718
7719/**
7720 * sensor_i2c_get_address: (skip)
7721 * @object: A #SensorI2c.
7722 *
7723 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7724 *
7725 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7726 *
7727 * <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>
7728 *
7729 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7730 */
7731const gchar *
7732sensor_i2c_get_address (SensorI2c *object)
7733{
7734 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7735}
7736
7737/**
7738 * sensor_i2c_dup_address: (skip)
7739 * @object: A #SensorI2c.
7740 *
7741 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7742 *
7743 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7744 *
7745 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7746 */
7747gchar *
7748sensor_i2c_dup_address (SensorI2c *object)
7749{
7750 gchar *value;
7751 g_object_get (G_OBJECT (object), "address", &value, NULL);
7752 return value;
7753}
7754
7755/**
7756 * sensor_i2c_set_address: (skip)
7757 * @object: A #SensorI2c.
7758 * @value: The value to set.
7759 *
7760 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7761 *
7762 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7763 */
7764void
7765sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7766{
7767 g_object_set (G_OBJECT (object), "address", value, NULL);
7768}
7769
7770/* ------------------------------------------------------------------------ */
7771
7772/**
7773 * SensorI2cProxy:
7774 *
7775 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7776 */
7777
7778/**
7779 * SensorI2cProxyClass:
7780 * @parent_class: The parent class.
7781 *
7782 * Class structure for #SensorI2cProxy.
7783 */
7784
7785struct _SensorI2cProxyPrivate
7786{
7787 GData *qdata;
7788};
7789
7790static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7791
7792#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7793G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7794 G_ADD_PRIVATE (SensorI2cProxy)
7795 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7796
7797#else
7798G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7799 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7800
7801#endif
7802static void
7803sensor_i2c_proxy_finalize (GObject *object)
7804{
7805 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7806 g_datalist_clear (&proxy->priv->qdata);
7807 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7808}
7809
7810static void
7811sensor_i2c_proxy_get_property (GObject *object,
7812 guint prop_id,
7813 GValue *value,
7814 GParamSpec *pspec G_GNUC_UNUSED)
7815{
7816 const _ExtendedGDBusPropertyInfo *info;
7817 GVariant *variant;
7818 g_assert (prop_id != 0 && prop_id - 1 < 2);
7819 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7820 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7821 if (info->use_gvariant)
7822 {
7823 g_value_set_variant (value, variant);
7824 }
7825 else
7826 {
7827 if (variant != NULL)
7828 g_dbus_gvariant_to_gvalue (variant, value);
7829 }
7830 if (variant != NULL)
7831 g_variant_unref (variant);
7832}
7833
7834static void
7835sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
7836 GAsyncResult *res,
7837 gpointer user_data)
7838{
7839 const _ExtendedGDBusPropertyInfo *info = user_data;
7840 GError *error;
7841 GVariant *_ret;
7842 error = NULL;
7843 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7844 if (!_ret)
7845 {
7846 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
7847 info->parent_struct.name,
7848 error->message, g_quark_to_string (error->domain), error->code);
7849 g_error_free (error);
7850 }
7851 else
7852 {
7853 g_variant_unref (_ret);
7854 }
7855}
7856
7857static void
7858sensor_i2c_proxy_set_property (GObject *object,
7859 guint prop_id,
7860 const GValue *value,
7861 GParamSpec *pspec G_GNUC_UNUSED)
7862{
7863 const _ExtendedGDBusPropertyInfo *info;
7864 GVariant *variant;
7865 g_assert (prop_id != 0 && prop_id - 1 < 2);
7866 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7867 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7868 g_dbus_proxy_call (G_DBUS_PROXY (object),
7869 "org.freedesktop.DBus.Properties.Set",
7870 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
7871 G_DBUS_CALL_FLAGS_NONE,
7872 -1,
7873 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7874 g_variant_unref (variant);
7875}
7876
7877static void
7878sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
7879 const gchar *sender_name G_GNUC_UNUSED,
7880 const gchar *signal_name,
7881 GVariant *parameters)
7882{
7883 _ExtendedGDBusSignalInfo *info;
7884 GVariantIter iter;
7885 GVariant *child;
7886 GValue *paramv;
7887 guint num_params;
7888 guint n;
7889 guint signal_id;
7890 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
7891 if (info == NULL)
7892 return;
7893 num_params = g_variant_n_children (parameters);
7894 paramv = g_new0 (GValue, num_params + 1);
7895 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
7896 g_value_set_object (&paramv[0], proxy);
7897 g_variant_iter_init (&iter, parameters);
7898 n = 1;
7899 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7900 {
7901 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7902 if (arg_info->use_gvariant)
7903 {
7904 g_value_init (&paramv[n], G_TYPE_VARIANT);
7905 g_value_set_variant (&paramv[n], child);
7906 n++;
7907 }
7908 else
7909 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7910 g_variant_unref (child);
7911 }
7912 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7913 g_signal_emitv (paramv, signal_id, 0, NULL);
7914 for (n = 0; n < num_params + 1; n++)
7915 g_value_unset (&paramv[n]);
7916 g_free (paramv);
7917}
7918
7919static void
7920sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
7921 GVariant *changed_properties,
7922 const gchar *const *invalidated_properties)
7923{
7924 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
7925 guint n;
7926 const gchar *key;
7927 GVariantIter *iter;
7928 _ExtendedGDBusPropertyInfo *info;
7929 g_variant_get (changed_properties, "a{sv}", &iter);
7930 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7931 {
7932 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
7933 g_datalist_remove_data (&proxy->priv->qdata, key);
7934 if (info != NULL)
7935 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7936 }
7937 g_variant_iter_free (iter);
7938 for (n = 0; invalidated_properties[n] != NULL; n++)
7939 {
7940 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
7941 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7942 if (info != NULL)
7943 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7944 }
7945}
7946
7947static const gchar *
7948sensor_i2c_proxy_get_dev_path (SensorI2c *object)
7949{
7950 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7951 GVariant *variant;
7952 const gchar *value = NULL;
7953 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
7954 if (variant != NULL)
7955 {
7956 value = g_variant_get_string (variant, NULL);
7957 g_variant_unref (variant);
7958 }
7959 return value;
7960}
7961
7962static const gchar *
7963sensor_i2c_proxy_get_address (SensorI2c *object)
7964{
7965 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7966 GVariant *variant;
7967 const gchar *value = NULL;
7968 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
7969 if (variant != NULL)
7970 {
7971 value = g_variant_get_string (variant, NULL);
7972 g_variant_unref (variant);
7973 }
7974 return value;
7975}
7976
7977static void
7978sensor_i2c_proxy_init (SensorI2cProxy *proxy)
7979{
7980#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7981 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
7982#else
7983 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
7984#endif
7985
7986 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
7987}
7988
7989static void
7990sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
7991{
7992 GObjectClass *gobject_class;
7993 GDBusProxyClass *proxy_class;
7994
7995 gobject_class = G_OBJECT_CLASS (klass);
7996 gobject_class->finalize = sensor_i2c_proxy_finalize;
7997 gobject_class->get_property = sensor_i2c_proxy_get_property;
7998 gobject_class->set_property = sensor_i2c_proxy_set_property;
7999
8000 proxy_class = G_DBUS_PROXY_CLASS (klass);
8001 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8002 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8003
8004 sensor_i2c_override_properties (gobject_class, 1);
8005
8006#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8007 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8008#endif
8009}
8010
8011static void
8012sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8013{
8014 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8015 iface->get_address = sensor_i2c_proxy_get_address;
8016}
8017
8018/**
8019 * sensor_i2c_proxy_new:
8020 * @connection: A #GDBusConnection.
8021 * @flags: Flags from the #GDBusProxyFlags enumeration.
8022 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8023 * @object_path: An object path.
8024 * @cancellable: (allow-none): A #GCancellable or %NULL.
8025 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8026 * @user_data: User data to pass to @callback.
8027 *
8028 * 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.
8029 *
8030 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8031 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8032 *
8033 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8034 */
8035void
8036sensor_i2c_proxy_new (
8037 GDBusConnection *connection,
8038 GDBusProxyFlags flags,
8039 const gchar *name,
8040 const gchar *object_path,
8041 GCancellable *cancellable,
8042 GAsyncReadyCallback callback,
8043 gpointer user_data)
8044{
8045 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);
8046}
8047
8048/**
8049 * sensor_i2c_proxy_new_finish:
8050 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8051 * @error: Return location for error or %NULL
8052 *
8053 * Finishes an operation started with sensor_i2c_proxy_new().
8054 *
8055 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8056 */
8057SensorI2c *
8058sensor_i2c_proxy_new_finish (
8059 GAsyncResult *res,
8060 GError **error)
8061{
8062 GObject *ret;
8063 GObject *source_object;
8064 source_object = g_async_result_get_source_object (res);
8065 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8066 g_object_unref (source_object);
8067 if (ret != NULL)
8068 return SENSOR_I2C (ret);
8069 else
8070 return NULL;
8071}
8072
8073/**
8074 * sensor_i2c_proxy_new_sync:
8075 * @connection: A #GDBusConnection.
8076 * @flags: Flags from the #GDBusProxyFlags enumeration.
8077 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8078 * @object_path: An object path.
8079 * @cancellable: (allow-none): A #GCancellable or %NULL.
8080 * @error: Return location for error or %NULL
8081 *
8082 * 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.
8083 *
8084 * The calling thread is blocked until a reply is received.
8085 *
8086 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8087 *
8088 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8089 */
8090SensorI2c *
8091sensor_i2c_proxy_new_sync (
8092 GDBusConnection *connection,
8093 GDBusProxyFlags flags,
8094 const gchar *name,
8095 const gchar *object_path,
8096 GCancellable *cancellable,
8097 GError **error)
8098{
8099 GInitable *ret;
8100 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);
8101 if (ret != NULL)
8102 return SENSOR_I2C (ret);
8103 else
8104 return NULL;
8105}
8106
8107
8108/**
8109 * sensor_i2c_proxy_new_for_bus:
8110 * @bus_type: A #GBusType.
8111 * @flags: Flags from the #GDBusProxyFlags enumeration.
8112 * @name: A bus name (well-known or unique).
8113 * @object_path: An object path.
8114 * @cancellable: (allow-none): A #GCancellable or %NULL.
8115 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8116 * @user_data: User data to pass to @callback.
8117 *
8118 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8119 *
8120 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8121 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8122 *
8123 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8124 */
8125void
8126sensor_i2c_proxy_new_for_bus (
8127 GBusType bus_type,
8128 GDBusProxyFlags flags,
8129 const gchar *name,
8130 const gchar *object_path,
8131 GCancellable *cancellable,
8132 GAsyncReadyCallback callback,
8133 gpointer user_data)
8134{
8135 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);
8136}
8137
8138/**
8139 * sensor_i2c_proxy_new_for_bus_finish:
8140 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8141 * @error: Return location for error or %NULL
8142 *
8143 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8144 *
8145 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8146 */
8147SensorI2c *
8148sensor_i2c_proxy_new_for_bus_finish (
8149 GAsyncResult *res,
8150 GError **error)
8151{
8152 GObject *ret;
8153 GObject *source_object;
8154 source_object = g_async_result_get_source_object (res);
8155 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8156 g_object_unref (source_object);
8157 if (ret != NULL)
8158 return SENSOR_I2C (ret);
8159 else
8160 return NULL;
8161}
8162
8163/**
8164 * sensor_i2c_proxy_new_for_bus_sync:
8165 * @bus_type: A #GBusType.
8166 * @flags: Flags from the #GDBusProxyFlags enumeration.
8167 * @name: A bus name (well-known or unique).
8168 * @object_path: An object path.
8169 * @cancellable: (allow-none): A #GCancellable or %NULL.
8170 * @error: Return location for error or %NULL
8171 *
8172 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8173 *
8174 * The calling thread is blocked until a reply is received.
8175 *
8176 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8177 *
8178 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8179 */
8180SensorI2c *
8181sensor_i2c_proxy_new_for_bus_sync (
8182 GBusType bus_type,
8183 GDBusProxyFlags flags,
8184 const gchar *name,
8185 const gchar *object_path,
8186 GCancellable *cancellable,
8187 GError **error)
8188{
8189 GInitable *ret;
8190 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);
8191 if (ret != NULL)
8192 return SENSOR_I2C (ret);
8193 else
8194 return NULL;
8195}
8196
8197
8198/* ------------------------------------------------------------------------ */
8199
8200/**
8201 * SensorI2cSkeleton:
8202 *
8203 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8204 */
8205
8206/**
8207 * SensorI2cSkeletonClass:
8208 * @parent_class: The parent class.
8209 *
8210 * Class structure for #SensorI2cSkeleton.
8211 */
8212
8213struct _SensorI2cSkeletonPrivate
8214{
8215 GValue *properties;
8216 GList *changed_properties;
8217 GSource *changed_properties_idle_source;
8218 GMainContext *context;
8219 GMutex lock;
8220};
8221
8222static void
8223_sensor_i2c_skeleton_handle_method_call (
8224 GDBusConnection *connection G_GNUC_UNUSED,
8225 const gchar *sender G_GNUC_UNUSED,
8226 const gchar *object_path G_GNUC_UNUSED,
8227 const gchar *interface_name,
8228 const gchar *method_name,
8229 GVariant *parameters,
8230 GDBusMethodInvocation *invocation,
8231 gpointer user_data)
8232{
8233 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8234 _ExtendedGDBusMethodInfo *info;
8235 GVariantIter iter;
8236 GVariant *child;
8237 GValue *paramv;
8238 guint num_params;
8239 guint num_extra;
8240 guint n;
8241 guint signal_id;
8242 GValue return_value = G_VALUE_INIT;
8243 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8244 g_assert (info != NULL);
8245 num_params = g_variant_n_children (parameters);
8246 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8247 n = 0;
8248 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8249 g_value_set_object (&paramv[n++], skeleton);
8250 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8251 g_value_set_object (&paramv[n++], invocation);
8252 if (info->pass_fdlist)
8253 {
8254#ifdef G_OS_UNIX
8255 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8256 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8257#else
8258 g_assert_not_reached ();
8259#endif
8260 }
8261 g_variant_iter_init (&iter, parameters);
8262 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8263 {
8264 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8265 if (arg_info->use_gvariant)
8266 {
8267 g_value_init (&paramv[n], G_TYPE_VARIANT);
8268 g_value_set_variant (&paramv[n], child);
8269 n++;
8270 }
8271 else
8272 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8273 g_variant_unref (child);
8274 }
8275 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8276 g_value_init (&return_value, G_TYPE_BOOLEAN);
8277 g_signal_emitv (paramv, signal_id, 0, &return_value);
8278 if (!g_value_get_boolean (&return_value))
8279 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);
8280 g_value_unset (&return_value);
8281 for (n = 0; n < num_params + num_extra; n++)
8282 g_value_unset (&paramv[n]);
8283 g_free (paramv);
8284}
8285
8286static GVariant *
8287_sensor_i2c_skeleton_handle_get_property (
8288 GDBusConnection *connection G_GNUC_UNUSED,
8289 const gchar *sender G_GNUC_UNUSED,
8290 const gchar *object_path G_GNUC_UNUSED,
8291 const gchar *interface_name G_GNUC_UNUSED,
8292 const gchar *property_name,
8293 GError **error,
8294 gpointer user_data)
8295{
8296 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8297 GValue value = G_VALUE_INIT;
8298 GParamSpec *pspec;
8299 _ExtendedGDBusPropertyInfo *info;
8300 GVariant *ret;
8301 ret = NULL;
8302 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8303 g_assert (info != NULL);
8304 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8305 if (pspec == NULL)
8306 {
8307 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8308 }
8309 else
8310 {
8311 g_value_init (&value, pspec->value_type);
8312 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8313 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8314 g_value_unset (&value);
8315 }
8316 return ret;
8317}
8318
8319static gboolean
8320_sensor_i2c_skeleton_handle_set_property (
8321 GDBusConnection *connection G_GNUC_UNUSED,
8322 const gchar *sender G_GNUC_UNUSED,
8323 const gchar *object_path G_GNUC_UNUSED,
8324 const gchar *interface_name G_GNUC_UNUSED,
8325 const gchar *property_name,
8326 GVariant *variant,
8327 GError **error,
8328 gpointer user_data)
8329{
8330 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8331 GValue value = G_VALUE_INIT;
8332 GParamSpec *pspec;
8333 _ExtendedGDBusPropertyInfo *info;
8334 gboolean ret;
8335 ret = FALSE;
8336 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8337 g_assert (info != NULL);
8338 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8339 if (pspec == NULL)
8340 {
8341 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8342 }
8343 else
8344 {
8345 if (info->use_gvariant)
8346 g_value_set_variant (&value, variant);
8347 else
8348 g_dbus_gvariant_to_gvalue (variant, &value);
8349 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8350 g_value_unset (&value);
8351 ret = TRUE;
8352 }
8353 return ret;
8354}
8355
8356static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8357{
8358 _sensor_i2c_skeleton_handle_method_call,
8359 _sensor_i2c_skeleton_handle_get_property,
8360 _sensor_i2c_skeleton_handle_set_property,
8361 {NULL}
8362};
8363
8364static GDBusInterfaceInfo *
8365sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8366{
8367 return sensor_i2c_interface_info ();
8368}
8369
8370static GDBusInterfaceVTable *
8371sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8372{
8373 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8374}
8375
8376static GVariant *
8377sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8378{
8379 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8380
8381 GVariantBuilder builder;
8382 guint n;
8383 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8384 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8385 goto out;
8386 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8387 {
8388 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8389 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8390 {
8391 GVariant *value;
8392 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);
8393 if (value != NULL)
8394 {
8395 g_variant_take_ref (value);
8396 g_variant_builder_add (&builder, "{sv}", info->name, value);
8397 g_variant_unref (value);
8398 }
8399 }
8400 }
8401out:
8402 return g_variant_builder_end (&builder);
8403}
8404
8405static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8406
8407static void
8408sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8409{
8410 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8411 gboolean emit_changed = FALSE;
8412
8413 g_mutex_lock (&skeleton->priv->lock);
8414 if (skeleton->priv->changed_properties_idle_source != NULL)
8415 {
8416 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8417 skeleton->priv->changed_properties_idle_source = NULL;
8418 emit_changed = TRUE;
8419 }
8420 g_mutex_unlock (&skeleton->priv->lock);
8421
8422 if (emit_changed)
8423 _sensor_i2c_emit_changed (skeleton);
8424}
8425
8426static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8427#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8428G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8429 G_ADD_PRIVATE (SensorI2cSkeleton)
8430 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8431
8432#else
8433G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8434 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8435
8436#endif
8437static void
8438sensor_i2c_skeleton_finalize (GObject *object)
8439{
8440 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8441 guint n;
8442 for (n = 0; n < 2; n++)
8443 g_value_unset (&skeleton->priv->properties[n]);
8444 g_free (skeleton->priv->properties);
8445 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8446 if (skeleton->priv->changed_properties_idle_source != NULL)
8447 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8448 g_main_context_unref (skeleton->priv->context);
8449 g_mutex_clear (&skeleton->priv->lock);
8450 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8451}
8452
8453static void
8454sensor_i2c_skeleton_get_property (GObject *object,
8455 guint prop_id,
8456 GValue *value,
8457 GParamSpec *pspec G_GNUC_UNUSED)
8458{
8459 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8460 g_assert (prop_id != 0 && prop_id - 1 < 2);
8461 g_mutex_lock (&skeleton->priv->lock);
8462 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8463 g_mutex_unlock (&skeleton->priv->lock);
8464}
8465
8466static gboolean
8467_sensor_i2c_emit_changed (gpointer user_data)
8468{
8469 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8470 GList *l;
8471 GVariantBuilder builder;
8472 GVariantBuilder invalidated_builder;
8473 guint num_changes;
8474
8475 g_mutex_lock (&skeleton->priv->lock);
8476 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8477 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8478 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8479 {
8480 ChangedProperty *cp = l->data;
8481 GVariant *variant;
8482 const GValue *cur_value;
8483
8484 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8485 if (!_g_value_equal (cur_value, &cp->orig_value))
8486 {
8487 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8488 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8489 g_variant_unref (variant);
8490 num_changes++;
8491 }
8492 }
8493 if (num_changes > 0)
8494 {
8495 GList *connections, *ll;
8496 GVariant *signal_variant;
8497 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8498 &builder, &invalidated_builder));
8499 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8500 for (ll = connections; ll != NULL; ll = ll->next)
8501 {
8502 GDBusConnection *connection = ll->data;
8503
8504 g_dbus_connection_emit_signal (connection,
8505 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8506 "org.freedesktop.DBus.Properties",
8507 "PropertiesChanged",
8508 signal_variant,
8509 NULL);
8510 }
8511 g_variant_unref (signal_variant);
8512 g_list_free_full (connections, g_object_unref);
8513 }
8514 else
8515 {
8516 g_variant_builder_clear (&builder);
8517 g_variant_builder_clear (&invalidated_builder);
8518 }
8519 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8520 skeleton->priv->changed_properties = NULL;
8521 skeleton->priv->changed_properties_idle_source = NULL;
8522 g_mutex_unlock (&skeleton->priv->lock);
8523 return FALSE;
8524}
8525
8526static void
8527_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8528{
8529 ChangedProperty *cp;
8530 GList *l;
8531 cp = NULL;
8532 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8533 {
8534 ChangedProperty *i_cp = l->data;
8535 if (i_cp->info == info)
8536 {
8537 cp = i_cp;
8538 break;
8539 }
8540 }
8541 if (cp == NULL)
8542 {
8543 cp = g_new0 (ChangedProperty, 1);
8544 cp->prop_id = prop_id;
8545 cp->info = info;
8546 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8547 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8548 g_value_copy (orig_value, &cp->orig_value);
8549 }
8550}
8551
8552static void
8553sensor_i2c_skeleton_notify (GObject *object,
8554 GParamSpec *pspec G_GNUC_UNUSED)
8555{
8556 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8557 g_mutex_lock (&skeleton->priv->lock);
8558 if (skeleton->priv->changed_properties != NULL &&
8559 skeleton->priv->changed_properties_idle_source == NULL)
8560 {
8561 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8562 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8563 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8564 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8565 g_source_unref (skeleton->priv->changed_properties_idle_source);
8566 }
8567 g_mutex_unlock (&skeleton->priv->lock);
8568}
8569
8570static void
8571sensor_i2c_skeleton_set_property (GObject *object,
8572 guint prop_id,
8573 const GValue *value,
8574 GParamSpec *pspec)
8575{
8576 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8577 g_assert (prop_id != 0 && prop_id - 1 < 2);
8578 g_mutex_lock (&skeleton->priv->lock);
8579 g_object_freeze_notify (object);
8580 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8581 {
8582 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8583 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8584 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8585 g_object_notify_by_pspec (object, pspec);
8586 }
8587 g_mutex_unlock (&skeleton->priv->lock);
8588 g_object_thaw_notify (object);
8589}
8590
8591static void
8592sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8593{
8594#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8595 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8596#else
8597 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8598#endif
8599
8600 g_mutex_init (&skeleton->priv->lock);
8601 skeleton->priv->context = g_main_context_ref_thread_default ();
8602 skeleton->priv->properties = g_new0 (GValue, 2);
8603 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8604 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8605}
8606
8607static const gchar *
8608sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8609{
8610 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8611 const gchar *value;
8612 g_mutex_lock (&skeleton->priv->lock);
8613 value = g_value_get_string (&(skeleton->priv->properties[0]));
8614 g_mutex_unlock (&skeleton->priv->lock);
8615 return value;
8616}
8617
8618static const gchar *
8619sensor_i2c_skeleton_get_address (SensorI2c *object)
8620{
8621 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8622 const gchar *value;
8623 g_mutex_lock (&skeleton->priv->lock);
8624 value = g_value_get_string (&(skeleton->priv->properties[1]));
8625 g_mutex_unlock (&skeleton->priv->lock);
8626 return value;
8627}
8628
8629static void
8630sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8631{
8632 GObjectClass *gobject_class;
8633 GDBusInterfaceSkeletonClass *skeleton_class;
8634
8635 gobject_class = G_OBJECT_CLASS (klass);
8636 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8637 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8638 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8639 gobject_class->notify = sensor_i2c_skeleton_notify;
8640
8641
8642 sensor_i2c_override_properties (gobject_class, 1);
8643
8644 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8645 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8646 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8647 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8648 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8649
8650#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8651 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8652#endif
8653}
8654
8655static void
8656sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8657{
8658 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8659 iface->get_address = sensor_i2c_skeleton_get_address;
8660}
8661
8662/**
8663 * sensor_i2c_skeleton_new:
8664 *
8665 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8666 *
8667 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8668 */
8669SensorI2c *
8670sensor_i2c_skeleton_new (void)
8671{
8672 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8673}
8674
8675/* ------------------------------------------------------------------------
8676 * Code for interface org.openbmc.SensorMatch
8677 * ------------------------------------------------------------------------
8678 */
8679
8680/**
8681 * SECTION:SensorMatch
8682 * @title: SensorMatch
8683 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8684 *
8685 * 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.
8686 */
8687
8688/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8689
8690static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8691{
8692 {
8693 -1,
8694 (gchar *) "state",
8695 (gchar *) "y",
8696 NULL
8697 },
8698 FALSE
8699};
8700
8701static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8702{
8703 &_sensor_match_signal_info_sensor_match_ARG_state,
8704 NULL
8705};
8706
8707static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8708{
8709 {
8710 -1,
8711 (gchar *) "SensorMatch",
8712 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8713 NULL
8714 },
8715 "sensor-match"
8716};
8717
8718static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8719{
8720 &_sensor_match_signal_info_sensor_match,
8721 NULL
8722};
8723
8724static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8725{
8726 {
8727 -1,
8728 (gchar *) "match_value",
8729 (gchar *) "v",
8730 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8731 NULL
8732 },
8733 "match-value",
8734 FALSE
8735};
8736
8737static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8738{
8739 {
8740 -1,
8741 (gchar *) "state",
8742 (gchar *) "y",
8743 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8744 NULL
8745 },
8746 "state",
8747 FALSE
8748};
8749
8750static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8751{
8752 &_sensor_match_property_info_match_value,
8753 &_sensor_match_property_info_state,
8754 NULL
8755};
8756
8757static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8758{
8759 {
8760 -1,
8761 (gchar *) "org.openbmc.SensorMatch",
8762 NULL,
8763 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8764 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8765 NULL
8766 },
8767 "sensor-match",
8768};
8769
8770
8771/**
8772 * sensor_match_interface_info:
8773 *
8774 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8775 *
8776 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8777 */
8778GDBusInterfaceInfo *
8779sensor_match_interface_info (void)
8780{
8781 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8782}
8783
8784/**
8785 * sensor_match_override_properties:
8786 * @klass: The class structure for a #GObject<!-- -->-derived class.
8787 * @property_id_begin: The property id to assign to the first overridden property.
8788 *
8789 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8790 * The properties are overridden in the order they are defined.
8791 *
8792 * Returns: The last property id.
8793 */
8794guint
8795sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8796{
8797 g_object_class_override_property (klass, property_id_begin++, "match-value");
8798 g_object_class_override_property (klass, property_id_begin++, "state");
8799 return property_id_begin - 1;
8800}
8801
8802
8803
8804/**
8805 * SensorMatch:
8806 *
8807 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8808 */
8809
8810/**
8811 * SensorMatchIface:
8812 * @parent_iface: The parent interface.
8813 * @get_match_value: Getter for the #SensorMatch:match-value property.
8814 * @get_state: Getter for the #SensorMatch:state property.
8815 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8816 *
8817 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8818 */
8819
8820typedef SensorMatchIface SensorMatchInterface;
8821G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8822
8823static void
8824sensor_match_default_init (SensorMatchIface *iface)
8825{
8826 /* GObject signals for received D-Bus signals: */
8827 /**
8828 * SensorMatch::sensor-match:
8829 * @object: A #SensorMatch.
8830 * @arg_state: Argument.
8831 *
8832 * 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.
8833 *
8834 * 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.
8835 */
8836 g_signal_new ("sensor-match",
8837 G_TYPE_FROM_INTERFACE (iface),
8838 G_SIGNAL_RUN_LAST,
8839 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
8840 NULL,
8841 NULL,
8842 g_cclosure_marshal_generic,
8843 G_TYPE_NONE,
8844 1, G_TYPE_UCHAR);
8845
8846 /* GObject properties for D-Bus properties: */
8847 /**
8848 * SensorMatch:match-value:
8849 *
8850 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
8851 *
8852 * 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.
8853 */
8854 g_object_interface_install_property (iface,
8855 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8856 /**
8857 * SensorMatch:state:
8858 *
8859 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
8860 *
8861 * 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.
8862 */
8863 g_object_interface_install_property (iface,
8864 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8865}
8866
8867/**
8868 * sensor_match_get_match_value: (skip)
8869 * @object: A #SensorMatch.
8870 *
8871 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8872 *
8873 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8874 *
8875 * <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>
8876 *
8877 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8878 */
8879GVariant *
8880sensor_match_get_match_value (SensorMatch *object)
8881{
8882 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
8883}
8884
8885/**
8886 * sensor_match_dup_match_value: (skip)
8887 * @object: A #SensorMatch.
8888 *
8889 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8890 *
8891 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8892 *
8893 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
8894 */
8895GVariant *
8896sensor_match_dup_match_value (SensorMatch *object)
8897{
8898 GVariant *value;
8899 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
8900 return value;
8901}
8902
8903/**
8904 * sensor_match_set_match_value: (skip)
8905 * @object: A #SensorMatch.
8906 * @value: The value to set.
8907 *
8908 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
8909 *
8910 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8911 */
8912void
8913sensor_match_set_match_value (SensorMatch *object, GVariant *value)
8914{
8915 g_object_set (G_OBJECT (object), "match-value", value, NULL);
8916}
8917
8918/**
8919 * sensor_match_get_state: (skip)
8920 * @object: A #SensorMatch.
8921 *
8922 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
8923 *
8924 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8925 *
8926 * Returns: The property value.
8927 */
8928guchar
8929sensor_match_get_state (SensorMatch *object)
8930{
8931 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
8932}
8933
8934/**
8935 * sensor_match_set_state: (skip)
8936 * @object: A #SensorMatch.
8937 * @value: The value to set.
8938 *
8939 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
8940 *
8941 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8942 */
8943void
8944sensor_match_set_state (SensorMatch *object, guchar value)
8945{
8946 g_object_set (G_OBJECT (object), "state", value, NULL);
8947}
8948
8949/**
8950 * sensor_match_emit_sensor_match:
8951 * @object: A #SensorMatch.
8952 * @arg_state: Argument to pass with the signal.
8953 *
8954 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
8955 */
8956void
8957sensor_match_emit_sensor_match (
8958 SensorMatch *object,
8959 guchar arg_state)
8960{
8961 g_signal_emit_by_name (object, "sensor-match", arg_state);
8962}
8963
8964/* ------------------------------------------------------------------------ */
8965
8966/**
8967 * SensorMatchProxy:
8968 *
8969 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
8970 */
8971
8972/**
8973 * SensorMatchProxyClass:
8974 * @parent_class: The parent class.
8975 *
8976 * Class structure for #SensorMatchProxy.
8977 */
8978
8979struct _SensorMatchProxyPrivate
8980{
8981 GData *qdata;
8982};
8983
8984static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
8985
8986#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8987G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8988 G_ADD_PRIVATE (SensorMatchProxy)
8989 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8990
8991#else
8992G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8993 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8994
8995#endif
8996static void
8997sensor_match_proxy_finalize (GObject *object)
8998{
8999 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9000 g_datalist_clear (&proxy->priv->qdata);
9001 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9002}
9003
9004static void
9005sensor_match_proxy_get_property (GObject *object,
9006 guint prop_id,
9007 GValue *value,
9008 GParamSpec *pspec G_GNUC_UNUSED)
9009{
9010 const _ExtendedGDBusPropertyInfo *info;
9011 GVariant *variant;
9012 g_assert (prop_id != 0 && prop_id - 1 < 2);
9013 info = _sensor_match_property_info_pointers[prop_id - 1];
9014 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9015 if (info->use_gvariant)
9016 {
9017 g_value_set_variant (value, variant);
9018 }
9019 else
9020 {
9021 if (variant != NULL)
9022 g_dbus_gvariant_to_gvalue (variant, value);
9023 }
9024 if (variant != NULL)
9025 g_variant_unref (variant);
9026}
9027
9028static void
9029sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9030 GAsyncResult *res,
9031 gpointer user_data)
9032{
9033 const _ExtendedGDBusPropertyInfo *info = user_data;
9034 GError *error;
9035 GVariant *_ret;
9036 error = NULL;
9037 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9038 if (!_ret)
9039 {
9040 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9041 info->parent_struct.name,
9042 error->message, g_quark_to_string (error->domain), error->code);
9043 g_error_free (error);
9044 }
9045 else
9046 {
9047 g_variant_unref (_ret);
9048 }
9049}
9050
9051static void
9052sensor_match_proxy_set_property (GObject *object,
9053 guint prop_id,
9054 const GValue *value,
9055 GParamSpec *pspec G_GNUC_UNUSED)
9056{
9057 const _ExtendedGDBusPropertyInfo *info;
9058 GVariant *variant;
9059 g_assert (prop_id != 0 && prop_id - 1 < 2);
9060 info = _sensor_match_property_info_pointers[prop_id - 1];
9061 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9062 g_dbus_proxy_call (G_DBUS_PROXY (object),
9063 "org.freedesktop.DBus.Properties.Set",
9064 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9065 G_DBUS_CALL_FLAGS_NONE,
9066 -1,
9067 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9068 g_variant_unref (variant);
9069}
9070
9071static void
9072sensor_match_proxy_g_signal (GDBusProxy *proxy,
9073 const gchar *sender_name G_GNUC_UNUSED,
9074 const gchar *signal_name,
9075 GVariant *parameters)
9076{
9077 _ExtendedGDBusSignalInfo *info;
9078 GVariantIter iter;
9079 GVariant *child;
9080 GValue *paramv;
9081 guint num_params;
9082 guint n;
9083 guint signal_id;
9084 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9085 if (info == NULL)
9086 return;
9087 num_params = g_variant_n_children (parameters);
9088 paramv = g_new0 (GValue, num_params + 1);
9089 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9090 g_value_set_object (&paramv[0], proxy);
9091 g_variant_iter_init (&iter, parameters);
9092 n = 1;
9093 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9094 {
9095 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9096 if (arg_info->use_gvariant)
9097 {
9098 g_value_init (&paramv[n], G_TYPE_VARIANT);
9099 g_value_set_variant (&paramv[n], child);
9100 n++;
9101 }
9102 else
9103 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9104 g_variant_unref (child);
9105 }
9106 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9107 g_signal_emitv (paramv, signal_id, 0, NULL);
9108 for (n = 0; n < num_params + 1; n++)
9109 g_value_unset (&paramv[n]);
9110 g_free (paramv);
9111}
9112
9113static void
9114sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9115 GVariant *changed_properties,
9116 const gchar *const *invalidated_properties)
9117{
9118 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9119 guint n;
9120 const gchar *key;
9121 GVariantIter *iter;
9122 _ExtendedGDBusPropertyInfo *info;
9123 g_variant_get (changed_properties, "a{sv}", &iter);
9124 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9125 {
9126 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9127 g_datalist_remove_data (&proxy->priv->qdata, key);
9128 if (info != NULL)
9129 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9130 }
9131 g_variant_iter_free (iter);
9132 for (n = 0; invalidated_properties[n] != NULL; n++)
9133 {
9134 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9135 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9136 if (info != NULL)
9137 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9138 }
9139}
9140
9141static GVariant *
9142sensor_match_proxy_get_match_value (SensorMatch *object)
9143{
9144 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9145 GVariant *variant;
9146 GVariant *value = NULL;
9147 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9148 value = variant;
9149 if (variant != NULL)
9150 g_variant_unref (variant);
9151 return value;
9152}
9153
9154static guchar
9155sensor_match_proxy_get_state (SensorMatch *object)
9156{
9157 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9158 GVariant *variant;
9159 guchar value = 0;
9160 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9161 if (variant != NULL)
9162 {
9163 value = g_variant_get_byte (variant);
9164 g_variant_unref (variant);
9165 }
9166 return value;
9167}
9168
9169static void
9170sensor_match_proxy_init (SensorMatchProxy *proxy)
9171{
9172#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9173 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9174#else
9175 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9176#endif
9177
9178 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9179}
9180
9181static void
9182sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9183{
9184 GObjectClass *gobject_class;
9185 GDBusProxyClass *proxy_class;
9186
9187 gobject_class = G_OBJECT_CLASS (klass);
9188 gobject_class->finalize = sensor_match_proxy_finalize;
9189 gobject_class->get_property = sensor_match_proxy_get_property;
9190 gobject_class->set_property = sensor_match_proxy_set_property;
9191
9192 proxy_class = G_DBUS_PROXY_CLASS (klass);
9193 proxy_class->g_signal = sensor_match_proxy_g_signal;
9194 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9195
9196 sensor_match_override_properties (gobject_class, 1);
9197
9198#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9199 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9200#endif
9201}
9202
9203static void
9204sensor_match_proxy_iface_init (SensorMatchIface *iface)
9205{
9206 iface->get_match_value = sensor_match_proxy_get_match_value;
9207 iface->get_state = sensor_match_proxy_get_state;
9208}
9209
9210/**
9211 * sensor_match_proxy_new:
9212 * @connection: A #GDBusConnection.
9213 * @flags: Flags from the #GDBusProxyFlags enumeration.
9214 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9215 * @object_path: An object path.
9216 * @cancellable: (allow-none): A #GCancellable or %NULL.
9217 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9218 * @user_data: User data to pass to @callback.
9219 *
9220 * 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.
9221 *
9222 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9223 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9224 *
9225 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9226 */
9227void
9228sensor_match_proxy_new (
9229 GDBusConnection *connection,
9230 GDBusProxyFlags flags,
9231 const gchar *name,
9232 const gchar *object_path,
9233 GCancellable *cancellable,
9234 GAsyncReadyCallback callback,
9235 gpointer user_data)
9236{
9237 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);
9238}
9239
9240/**
9241 * sensor_match_proxy_new_finish:
9242 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9243 * @error: Return location for error or %NULL
9244 *
9245 * Finishes an operation started with sensor_match_proxy_new().
9246 *
9247 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9248 */
9249SensorMatch *
9250sensor_match_proxy_new_finish (
9251 GAsyncResult *res,
9252 GError **error)
9253{
9254 GObject *ret;
9255 GObject *source_object;
9256 source_object = g_async_result_get_source_object (res);
9257 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9258 g_object_unref (source_object);
9259 if (ret != NULL)
9260 return SENSOR_MATCH (ret);
9261 else
9262 return NULL;
9263}
9264
9265/**
9266 * sensor_match_proxy_new_sync:
9267 * @connection: A #GDBusConnection.
9268 * @flags: Flags from the #GDBusProxyFlags enumeration.
9269 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9270 * @object_path: An object path.
9271 * @cancellable: (allow-none): A #GCancellable or %NULL.
9272 * @error: Return location for error or %NULL
9273 *
9274 * 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.
9275 *
9276 * The calling thread is blocked until a reply is received.
9277 *
9278 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9279 *
9280 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9281 */
9282SensorMatch *
9283sensor_match_proxy_new_sync (
9284 GDBusConnection *connection,
9285 GDBusProxyFlags flags,
9286 const gchar *name,
9287 const gchar *object_path,
9288 GCancellable *cancellable,
9289 GError **error)
9290{
9291 GInitable *ret;
9292 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);
9293 if (ret != NULL)
9294 return SENSOR_MATCH (ret);
9295 else
9296 return NULL;
9297}
9298
9299
9300/**
9301 * sensor_match_proxy_new_for_bus:
9302 * @bus_type: A #GBusType.
9303 * @flags: Flags from the #GDBusProxyFlags enumeration.
9304 * @name: A bus name (well-known or unique).
9305 * @object_path: An object path.
9306 * @cancellable: (allow-none): A #GCancellable or %NULL.
9307 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9308 * @user_data: User data to pass to @callback.
9309 *
9310 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9311 *
9312 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9313 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9314 *
9315 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9316 */
9317void
9318sensor_match_proxy_new_for_bus (
9319 GBusType bus_type,
9320 GDBusProxyFlags flags,
9321 const gchar *name,
9322 const gchar *object_path,
9323 GCancellable *cancellable,
9324 GAsyncReadyCallback callback,
9325 gpointer user_data)
9326{
9327 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);
9328}
9329
9330/**
9331 * sensor_match_proxy_new_for_bus_finish:
9332 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9333 * @error: Return location for error or %NULL
9334 *
9335 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9336 *
9337 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9338 */
9339SensorMatch *
9340sensor_match_proxy_new_for_bus_finish (
9341 GAsyncResult *res,
9342 GError **error)
9343{
9344 GObject *ret;
9345 GObject *source_object;
9346 source_object = g_async_result_get_source_object (res);
9347 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9348 g_object_unref (source_object);
9349 if (ret != NULL)
9350 return SENSOR_MATCH (ret);
9351 else
9352 return NULL;
9353}
9354
9355/**
9356 * sensor_match_proxy_new_for_bus_sync:
9357 * @bus_type: A #GBusType.
9358 * @flags: Flags from the #GDBusProxyFlags enumeration.
9359 * @name: A bus name (well-known or unique).
9360 * @object_path: An object path.
9361 * @cancellable: (allow-none): A #GCancellable or %NULL.
9362 * @error: Return location for error or %NULL
9363 *
9364 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9365 *
9366 * The calling thread is blocked until a reply is received.
9367 *
9368 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9369 *
9370 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9371 */
9372SensorMatch *
9373sensor_match_proxy_new_for_bus_sync (
9374 GBusType bus_type,
9375 GDBusProxyFlags flags,
9376 const gchar *name,
9377 const gchar *object_path,
9378 GCancellable *cancellable,
9379 GError **error)
9380{
9381 GInitable *ret;
9382 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);
9383 if (ret != NULL)
9384 return SENSOR_MATCH (ret);
9385 else
9386 return NULL;
9387}
9388
9389
9390/* ------------------------------------------------------------------------ */
9391
9392/**
9393 * SensorMatchSkeleton:
9394 *
9395 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9396 */
9397
9398/**
9399 * SensorMatchSkeletonClass:
9400 * @parent_class: The parent class.
9401 *
9402 * Class structure for #SensorMatchSkeleton.
9403 */
9404
9405struct _SensorMatchSkeletonPrivate
9406{
9407 GValue *properties;
9408 GList *changed_properties;
9409 GSource *changed_properties_idle_source;
9410 GMainContext *context;
9411 GMutex lock;
9412};
9413
9414static void
9415_sensor_match_skeleton_handle_method_call (
9416 GDBusConnection *connection G_GNUC_UNUSED,
9417 const gchar *sender G_GNUC_UNUSED,
9418 const gchar *object_path G_GNUC_UNUSED,
9419 const gchar *interface_name,
9420 const gchar *method_name,
9421 GVariant *parameters,
9422 GDBusMethodInvocation *invocation,
9423 gpointer user_data)
9424{
9425 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9426 _ExtendedGDBusMethodInfo *info;
9427 GVariantIter iter;
9428 GVariant *child;
9429 GValue *paramv;
9430 guint num_params;
9431 guint num_extra;
9432 guint n;
9433 guint signal_id;
9434 GValue return_value = G_VALUE_INIT;
9435 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9436 g_assert (info != NULL);
9437 num_params = g_variant_n_children (parameters);
9438 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9439 n = 0;
9440 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9441 g_value_set_object (&paramv[n++], skeleton);
9442 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9443 g_value_set_object (&paramv[n++], invocation);
9444 if (info->pass_fdlist)
9445 {
9446#ifdef G_OS_UNIX
9447 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9448 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9449#else
9450 g_assert_not_reached ();
9451#endif
9452 }
9453 g_variant_iter_init (&iter, parameters);
9454 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9455 {
9456 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9457 if (arg_info->use_gvariant)
9458 {
9459 g_value_init (&paramv[n], G_TYPE_VARIANT);
9460 g_value_set_variant (&paramv[n], child);
9461 n++;
9462 }
9463 else
9464 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9465 g_variant_unref (child);
9466 }
9467 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9468 g_value_init (&return_value, G_TYPE_BOOLEAN);
9469 g_signal_emitv (paramv, signal_id, 0, &return_value);
9470 if (!g_value_get_boolean (&return_value))
9471 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);
9472 g_value_unset (&return_value);
9473 for (n = 0; n < num_params + num_extra; n++)
9474 g_value_unset (&paramv[n]);
9475 g_free (paramv);
9476}
9477
9478static GVariant *
9479_sensor_match_skeleton_handle_get_property (
9480 GDBusConnection *connection G_GNUC_UNUSED,
9481 const gchar *sender G_GNUC_UNUSED,
9482 const gchar *object_path G_GNUC_UNUSED,
9483 const gchar *interface_name G_GNUC_UNUSED,
9484 const gchar *property_name,
9485 GError **error,
9486 gpointer user_data)
9487{
9488 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9489 GValue value = G_VALUE_INIT;
9490 GParamSpec *pspec;
9491 _ExtendedGDBusPropertyInfo *info;
9492 GVariant *ret;
9493 ret = NULL;
9494 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9495 g_assert (info != NULL);
9496 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9497 if (pspec == NULL)
9498 {
9499 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9500 }
9501 else
9502 {
9503 g_value_init (&value, pspec->value_type);
9504 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9505 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9506 g_value_unset (&value);
9507 }
9508 return ret;
9509}
9510
9511static gboolean
9512_sensor_match_skeleton_handle_set_property (
9513 GDBusConnection *connection G_GNUC_UNUSED,
9514 const gchar *sender G_GNUC_UNUSED,
9515 const gchar *object_path G_GNUC_UNUSED,
9516 const gchar *interface_name G_GNUC_UNUSED,
9517 const gchar *property_name,
9518 GVariant *variant,
9519 GError **error,
9520 gpointer user_data)
9521{
9522 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9523 GValue value = G_VALUE_INIT;
9524 GParamSpec *pspec;
9525 _ExtendedGDBusPropertyInfo *info;
9526 gboolean ret;
9527 ret = FALSE;
9528 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9529 g_assert (info != NULL);
9530 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9531 if (pspec == NULL)
9532 {
9533 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9534 }
9535 else
9536 {
9537 if (info->use_gvariant)
9538 g_value_set_variant (&value, variant);
9539 else
9540 g_dbus_gvariant_to_gvalue (variant, &value);
9541 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9542 g_value_unset (&value);
9543 ret = TRUE;
9544 }
9545 return ret;
9546}
9547
9548static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9549{
9550 _sensor_match_skeleton_handle_method_call,
9551 _sensor_match_skeleton_handle_get_property,
9552 _sensor_match_skeleton_handle_set_property,
9553 {NULL}
9554};
9555
9556static GDBusInterfaceInfo *
9557sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9558{
9559 return sensor_match_interface_info ();
9560}
9561
9562static GDBusInterfaceVTable *
9563sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9564{
9565 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9566}
9567
9568static GVariant *
9569sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9570{
9571 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9572
9573 GVariantBuilder builder;
9574 guint n;
9575 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9576 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9577 goto out;
9578 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9579 {
9580 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9581 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9582 {
9583 GVariant *value;
9584 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);
9585 if (value != NULL)
9586 {
9587 g_variant_take_ref (value);
9588 g_variant_builder_add (&builder, "{sv}", info->name, value);
9589 g_variant_unref (value);
9590 }
9591 }
9592 }
9593out:
9594 return g_variant_builder_end (&builder);
9595}
9596
9597static gboolean _sensor_match_emit_changed (gpointer user_data);
9598
9599static void
9600sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9601{
9602 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9603 gboolean emit_changed = FALSE;
9604
9605 g_mutex_lock (&skeleton->priv->lock);
9606 if (skeleton->priv->changed_properties_idle_source != NULL)
9607 {
9608 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9609 skeleton->priv->changed_properties_idle_source = NULL;
9610 emit_changed = TRUE;
9611 }
9612 g_mutex_unlock (&skeleton->priv->lock);
9613
9614 if (emit_changed)
9615 _sensor_match_emit_changed (skeleton);
9616}
9617
9618static void
9619_sensor_match_on_signal_sensor_match (
9620 SensorMatch *object,
9621 guchar arg_state)
9622{
9623 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9624
9625 GList *connections, *l;
9626 GVariant *signal_variant;
9627 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9628
9629 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9630 arg_state));
9631 for (l = connections; l != NULL; l = l->next)
9632 {
9633 GDBusConnection *connection = l->data;
9634 g_dbus_connection_emit_signal (connection,
9635 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9636 signal_variant, NULL);
9637 }
9638 g_variant_unref (signal_variant);
9639 g_list_free_full (connections, g_object_unref);
9640}
9641
9642static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9643#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9644G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9645 G_ADD_PRIVATE (SensorMatchSkeleton)
9646 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9647
9648#else
9649G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9650 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9651
9652#endif
9653static void
9654sensor_match_skeleton_finalize (GObject *object)
9655{
9656 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9657 guint n;
9658 for (n = 0; n < 2; n++)
9659 g_value_unset (&skeleton->priv->properties[n]);
9660 g_free (skeleton->priv->properties);
9661 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9662 if (skeleton->priv->changed_properties_idle_source != NULL)
9663 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9664 g_main_context_unref (skeleton->priv->context);
9665 g_mutex_clear (&skeleton->priv->lock);
9666 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9667}
9668
9669static void
9670sensor_match_skeleton_get_property (GObject *object,
9671 guint prop_id,
9672 GValue *value,
9673 GParamSpec *pspec G_GNUC_UNUSED)
9674{
9675 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9676 g_assert (prop_id != 0 && prop_id - 1 < 2);
9677 g_mutex_lock (&skeleton->priv->lock);
9678 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9679 g_mutex_unlock (&skeleton->priv->lock);
9680}
9681
9682static gboolean
9683_sensor_match_emit_changed (gpointer user_data)
9684{
9685 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9686 GList *l;
9687 GVariantBuilder builder;
9688 GVariantBuilder invalidated_builder;
9689 guint num_changes;
9690
9691 g_mutex_lock (&skeleton->priv->lock);
9692 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9693 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9694 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9695 {
9696 ChangedProperty *cp = l->data;
9697 GVariant *variant;
9698 const GValue *cur_value;
9699
9700 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9701 if (!_g_value_equal (cur_value, &cp->orig_value))
9702 {
9703 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9704 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9705 g_variant_unref (variant);
9706 num_changes++;
9707 }
9708 }
9709 if (num_changes > 0)
9710 {
9711 GList *connections, *ll;
9712 GVariant *signal_variant;
9713 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9714 &builder, &invalidated_builder));
9715 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9716 for (ll = connections; ll != NULL; ll = ll->next)
9717 {
9718 GDBusConnection *connection = ll->data;
9719
9720 g_dbus_connection_emit_signal (connection,
9721 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9722 "org.freedesktop.DBus.Properties",
9723 "PropertiesChanged",
9724 signal_variant,
9725 NULL);
9726 }
9727 g_variant_unref (signal_variant);
9728 g_list_free_full (connections, g_object_unref);
9729 }
9730 else
9731 {
9732 g_variant_builder_clear (&builder);
9733 g_variant_builder_clear (&invalidated_builder);
9734 }
9735 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9736 skeleton->priv->changed_properties = NULL;
9737 skeleton->priv->changed_properties_idle_source = NULL;
9738 g_mutex_unlock (&skeleton->priv->lock);
9739 return FALSE;
9740}
9741
9742static void
9743_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9744{
9745 ChangedProperty *cp;
9746 GList *l;
9747 cp = NULL;
9748 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9749 {
9750 ChangedProperty *i_cp = l->data;
9751 if (i_cp->info == info)
9752 {
9753 cp = i_cp;
9754 break;
9755 }
9756 }
9757 if (cp == NULL)
9758 {
9759 cp = g_new0 (ChangedProperty, 1);
9760 cp->prop_id = prop_id;
9761 cp->info = info;
9762 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9763 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9764 g_value_copy (orig_value, &cp->orig_value);
9765 }
9766}
9767
9768static void
9769sensor_match_skeleton_notify (GObject *object,
9770 GParamSpec *pspec G_GNUC_UNUSED)
9771{
9772 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9773 g_mutex_lock (&skeleton->priv->lock);
9774 if (skeleton->priv->changed_properties != NULL &&
9775 skeleton->priv->changed_properties_idle_source == NULL)
9776 {
9777 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9778 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9779 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9780 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9781 g_source_unref (skeleton->priv->changed_properties_idle_source);
9782 }
9783 g_mutex_unlock (&skeleton->priv->lock);
9784}
9785
9786static void
9787sensor_match_skeleton_set_property (GObject *object,
9788 guint prop_id,
9789 const GValue *value,
9790 GParamSpec *pspec)
9791{
9792 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9793 g_assert (prop_id != 0 && prop_id - 1 < 2);
9794 g_mutex_lock (&skeleton->priv->lock);
9795 g_object_freeze_notify (object);
9796 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9797 {
9798 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9799 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9800 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9801 g_object_notify_by_pspec (object, pspec);
9802 }
9803 g_mutex_unlock (&skeleton->priv->lock);
9804 g_object_thaw_notify (object);
9805}
9806
9807static void
9808sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9809{
9810#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9811 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9812#else
9813 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9814#endif
9815
9816 g_mutex_init (&skeleton->priv->lock);
9817 skeleton->priv->context = g_main_context_ref_thread_default ();
9818 skeleton->priv->properties = g_new0 (GValue, 2);
9819 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9820 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9821}
9822
9823static GVariant *
9824sensor_match_skeleton_get_match_value (SensorMatch *object)
9825{
9826 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9827 GVariant *value;
9828 g_mutex_lock (&skeleton->priv->lock);
9829 value = g_value_get_variant (&(skeleton->priv->properties[0]));
9830 g_mutex_unlock (&skeleton->priv->lock);
9831 return value;
9832}
9833
9834static guchar
9835sensor_match_skeleton_get_state (SensorMatch *object)
9836{
9837 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9838 guchar value;
9839 g_mutex_lock (&skeleton->priv->lock);
9840 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
9841 g_mutex_unlock (&skeleton->priv->lock);
9842 return value;
9843}
9844
9845static void
9846sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
9847{
9848 GObjectClass *gobject_class;
9849 GDBusInterfaceSkeletonClass *skeleton_class;
9850
9851 gobject_class = G_OBJECT_CLASS (klass);
9852 gobject_class->finalize = sensor_match_skeleton_finalize;
9853 gobject_class->get_property = sensor_match_skeleton_get_property;
9854 gobject_class->set_property = sensor_match_skeleton_set_property;
9855 gobject_class->notify = sensor_match_skeleton_notify;
9856
9857
9858 sensor_match_override_properties (gobject_class, 1);
9859
9860 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9861 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
9862 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
9863 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
9864 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
9865
9866#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9867 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
9868#endif
9869}
9870
9871static void
9872sensor_match_skeleton_iface_init (SensorMatchIface *iface)
9873{
9874 iface->sensor_match = _sensor_match_on_signal_sensor_match;
9875 iface->get_match_value = sensor_match_skeleton_get_match_value;
9876 iface->get_state = sensor_match_skeleton_get_state;
9877}
9878
9879/**
9880 * sensor_match_skeleton_new:
9881 *
9882 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9883 *
9884 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
9885 */
9886SensorMatch *
9887sensor_match_skeleton_new (void)
9888{
9889 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
9890}
9891
9892/* ------------------------------------------------------------------------
9893 * Code for interface org.openbmc.Process
9894 * ------------------------------------------------------------------------
9895 */
9896
9897/**
9898 * SECTION:Process
9899 * @title: Process
9900 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
9901 *
9902 * 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.
9903 */
9904
9905/* ---- Introspection data for org.openbmc.Process ---- */
9906
9907static const _ExtendedGDBusMethodInfo _process_method_info_stop =
9908{
9909 {
9910 -1,
9911 (gchar *) "stop",
9912 NULL,
9913 NULL,
9914 NULL
9915 },
9916 "handle-stop",
9917 FALSE
9918};
9919
9920static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
9921{
9922 &_process_method_info_stop,
9923 NULL
9924};
9925
9926static const _ExtendedGDBusInterfaceInfo _process_interface_info =
9927{
9928 {
9929 -1,
9930 (gchar *) "org.openbmc.Process",
9931 (GDBusMethodInfo **) &_process_method_info_pointers,
9932 NULL,
9933 NULL,
9934 NULL
9935 },
9936 "process",
9937};
9938
9939
9940/**
9941 * process_interface_info:
9942 *
9943 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
9944 *
9945 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9946 */
9947GDBusInterfaceInfo *
9948process_interface_info (void)
9949{
9950 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
9951}
9952
9953/**
9954 * process_override_properties:
9955 * @klass: The class structure for a #GObject<!-- -->-derived class.
9956 * @property_id_begin: The property id to assign to the first overridden property.
9957 *
9958 * Overrides all #GObject properties in the #Process interface for a concrete class.
9959 * The properties are overridden in the order they are defined.
9960 *
9961 * Returns: The last property id.
9962 */
9963guint
9964process_override_properties (GObjectClass *klass, guint property_id_begin)
9965{
9966 return property_id_begin - 1;
9967}
9968
9969
9970
9971/**
9972 * Process:
9973 *
9974 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9975 */
9976
9977/**
9978 * ProcessIface:
9979 * @parent_iface: The parent interface.
9980 * @handle_stop: Handler for the #Process::handle-stop signal.
9981 *
9982 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9983 */
9984
9985typedef ProcessIface ProcessInterface;
9986G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
9987
9988static void
9989process_default_init (ProcessIface *iface)
9990{
9991 /* GObject signals for incoming D-Bus method calls: */
9992 /**
9993 * Process::handle-stop:
9994 * @object: A #Process.
9995 * @invocation: A #GDBusMethodInvocation.
9996 *
9997 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
9998 *
9999 * 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.
10000 *
10001 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10002 */
10003 g_signal_new ("handle-stop",
10004 G_TYPE_FROM_INTERFACE (iface),
10005 G_SIGNAL_RUN_LAST,
10006 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10007 g_signal_accumulator_true_handled,
10008 NULL,
10009 g_cclosure_marshal_generic,
10010 G_TYPE_BOOLEAN,
10011 1,
10012 G_TYPE_DBUS_METHOD_INVOCATION);
10013
10014}
10015
10016/**
10017 * process_call_stop:
10018 * @proxy: A #ProcessProxy.
10019 * @cancellable: (allow-none): A #GCancellable or %NULL.
10020 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10021 * @user_data: User data to pass to @callback.
10022 *
10023 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10024 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10025 * You can then call process_call_stop_finish() to get the result of the operation.
10026 *
10027 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10028 */
10029void
10030process_call_stop (
10031 Process *proxy,
10032 GCancellable *cancellable,
10033 GAsyncReadyCallback callback,
10034 gpointer user_data)
10035{
10036 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10037 "stop",
10038 g_variant_new ("()"),
10039 G_DBUS_CALL_FLAGS_NONE,
10040 -1,
10041 cancellable,
10042 callback,
10043 user_data);
10044}
10045
10046/**
10047 * process_call_stop_finish:
10048 * @proxy: A #ProcessProxy.
10049 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10050 * @error: Return location for error or %NULL.
10051 *
10052 * Finishes an operation started with process_call_stop().
10053 *
10054 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10055 */
10056gboolean
10057process_call_stop_finish (
10058 Process *proxy,
10059 GAsyncResult *res,
10060 GError **error)
10061{
10062 GVariant *_ret;
10063 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10064 if (_ret == NULL)
10065 goto _out;
10066 g_variant_get (_ret,
10067 "()");
10068 g_variant_unref (_ret);
10069_out:
10070 return _ret != NULL;
10071}
10072
10073/**
10074 * process_call_stop_sync:
10075 * @proxy: A #ProcessProxy.
10076 * @cancellable: (allow-none): A #GCancellable or %NULL.
10077 * @error: Return location for error or %NULL.
10078 *
10079 * 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.
10080 *
10081 * See process_call_stop() for the asynchronous version of this method.
10082 *
10083 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10084 */
10085gboolean
10086process_call_stop_sync (
10087 Process *proxy,
10088 GCancellable *cancellable,
10089 GError **error)
10090{
10091 GVariant *_ret;
10092 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10093 "stop",
10094 g_variant_new ("()"),
10095 G_DBUS_CALL_FLAGS_NONE,
10096 -1,
10097 cancellable,
10098 error);
10099 if (_ret == NULL)
10100 goto _out;
10101 g_variant_get (_ret,
10102 "()");
10103 g_variant_unref (_ret);
10104_out:
10105 return _ret != NULL;
10106}
10107
10108/**
10109 * process_complete_stop:
10110 * @object: A #Process.
10111 * @invocation: (transfer full): A #GDBusMethodInvocation.
10112 *
10113 * 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.
10114 *
10115 * This method will free @invocation, you cannot use it afterwards.
10116 */
10117void
10118process_complete_stop (
10119 Process *object,
10120 GDBusMethodInvocation *invocation)
10121{
10122 g_dbus_method_invocation_return_value (invocation,
10123 g_variant_new ("()"));
10124}
10125
10126/* ------------------------------------------------------------------------ */
10127
10128/**
10129 * ProcessProxy:
10130 *
10131 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10132 */
10133
10134/**
10135 * ProcessProxyClass:
10136 * @parent_class: The parent class.
10137 *
10138 * Class structure for #ProcessProxy.
10139 */
10140
10141struct _ProcessProxyPrivate
10142{
10143 GData *qdata;
10144};
10145
10146static void process_proxy_iface_init (ProcessIface *iface);
10147
10148#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10149G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10150 G_ADD_PRIVATE (ProcessProxy)
10151 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10152
10153#else
10154G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10155 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10156
10157#endif
10158static void
10159process_proxy_finalize (GObject *object)
10160{
10161 ProcessProxy *proxy = PROCESS_PROXY (object);
10162 g_datalist_clear (&proxy->priv->qdata);
10163 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10164}
10165
10166static void
10167process_proxy_get_property (GObject *object,
10168 guint prop_id,
10169 GValue *value,
10170 GParamSpec *pspec G_GNUC_UNUSED)
10171{
10172}
10173
10174static void
10175process_proxy_set_property (GObject *object,
10176 guint prop_id,
10177 const GValue *value,
10178 GParamSpec *pspec G_GNUC_UNUSED)
10179{
10180}
10181
10182static void
10183process_proxy_g_signal (GDBusProxy *proxy,
10184 const gchar *sender_name G_GNUC_UNUSED,
10185 const gchar *signal_name,
10186 GVariant *parameters)
10187{
10188 _ExtendedGDBusSignalInfo *info;
10189 GVariantIter iter;
10190 GVariant *child;
10191 GValue *paramv;
10192 guint num_params;
10193 guint n;
10194 guint signal_id;
10195 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10196 if (info == NULL)
10197 return;
10198 num_params = g_variant_n_children (parameters);
10199 paramv = g_new0 (GValue, num_params + 1);
10200 g_value_init (&paramv[0], TYPE_PROCESS);
10201 g_value_set_object (&paramv[0], proxy);
10202 g_variant_iter_init (&iter, parameters);
10203 n = 1;
10204 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10205 {
10206 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10207 if (arg_info->use_gvariant)
10208 {
10209 g_value_init (&paramv[n], G_TYPE_VARIANT);
10210 g_value_set_variant (&paramv[n], child);
10211 n++;
10212 }
10213 else
10214 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10215 g_variant_unref (child);
10216 }
10217 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10218 g_signal_emitv (paramv, signal_id, 0, NULL);
10219 for (n = 0; n < num_params + 1; n++)
10220 g_value_unset (&paramv[n]);
10221 g_free (paramv);
10222}
10223
10224static void
10225process_proxy_g_properties_changed (GDBusProxy *_proxy,
10226 GVariant *changed_properties,
10227 const gchar *const *invalidated_properties)
10228{
10229 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10230 guint n;
10231 const gchar *key;
10232 GVariantIter *iter;
10233 _ExtendedGDBusPropertyInfo *info;
10234 g_variant_get (changed_properties, "a{sv}", &iter);
10235 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10236 {
10237 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10238 g_datalist_remove_data (&proxy->priv->qdata, key);
10239 if (info != NULL)
10240 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10241 }
10242 g_variant_iter_free (iter);
10243 for (n = 0; invalidated_properties[n] != NULL; n++)
10244 {
10245 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10246 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10247 if (info != NULL)
10248 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10249 }
10250}
10251
10252static void
10253process_proxy_init (ProcessProxy *proxy)
10254{
10255#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10256 proxy->priv = process_proxy_get_instance_private (proxy);
10257#else
10258 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10259#endif
10260
10261 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10262}
10263
10264static void
10265process_proxy_class_init (ProcessProxyClass *klass)
10266{
10267 GObjectClass *gobject_class;
10268 GDBusProxyClass *proxy_class;
10269
10270 gobject_class = G_OBJECT_CLASS (klass);
10271 gobject_class->finalize = process_proxy_finalize;
10272 gobject_class->get_property = process_proxy_get_property;
10273 gobject_class->set_property = process_proxy_set_property;
10274
10275 proxy_class = G_DBUS_PROXY_CLASS (klass);
10276 proxy_class->g_signal = process_proxy_g_signal;
10277 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10278
10279#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10280 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10281#endif
10282}
10283
10284static void
10285process_proxy_iface_init (ProcessIface *iface)
10286{
10287}
10288
10289/**
10290 * process_proxy_new:
10291 * @connection: A #GDBusConnection.
10292 * @flags: Flags from the #GDBusProxyFlags enumeration.
10293 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10294 * @object_path: An object path.
10295 * @cancellable: (allow-none): A #GCancellable or %NULL.
10296 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10297 * @user_data: User data to pass to @callback.
10298 *
10299 * 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.
10300 *
10301 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10302 * You can then call process_proxy_new_finish() to get the result of the operation.
10303 *
10304 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10305 */
10306void
10307process_proxy_new (
10308 GDBusConnection *connection,
10309 GDBusProxyFlags flags,
10310 const gchar *name,
10311 const gchar *object_path,
10312 GCancellable *cancellable,
10313 GAsyncReadyCallback callback,
10314 gpointer user_data)
10315{
10316 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);
10317}
10318
10319/**
10320 * process_proxy_new_finish:
10321 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10322 * @error: Return location for error or %NULL
10323 *
10324 * Finishes an operation started with process_proxy_new().
10325 *
10326 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10327 */
10328Process *
10329process_proxy_new_finish (
10330 GAsyncResult *res,
10331 GError **error)
10332{
10333 GObject *ret;
10334 GObject *source_object;
10335 source_object = g_async_result_get_source_object (res);
10336 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10337 g_object_unref (source_object);
10338 if (ret != NULL)
10339 return PROCESS (ret);
10340 else
10341 return NULL;
10342}
10343
10344/**
10345 * process_proxy_new_sync:
10346 * @connection: A #GDBusConnection.
10347 * @flags: Flags from the #GDBusProxyFlags enumeration.
10348 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10349 * @object_path: An object path.
10350 * @cancellable: (allow-none): A #GCancellable or %NULL.
10351 * @error: Return location for error or %NULL
10352 *
10353 * 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.
10354 *
10355 * The calling thread is blocked until a reply is received.
10356 *
10357 * See process_proxy_new() for the asynchronous version of this constructor.
10358 *
10359 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10360 */
10361Process *
10362process_proxy_new_sync (
10363 GDBusConnection *connection,
10364 GDBusProxyFlags flags,
10365 const gchar *name,
10366 const gchar *object_path,
10367 GCancellable *cancellable,
10368 GError **error)
10369{
10370 GInitable *ret;
10371 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);
10372 if (ret != NULL)
10373 return PROCESS (ret);
10374 else
10375 return NULL;
10376}
10377
10378
10379/**
10380 * process_proxy_new_for_bus:
10381 * @bus_type: A #GBusType.
10382 * @flags: Flags from the #GDBusProxyFlags enumeration.
10383 * @name: A bus name (well-known or unique).
10384 * @object_path: An object path.
10385 * @cancellable: (allow-none): A #GCancellable or %NULL.
10386 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10387 * @user_data: User data to pass to @callback.
10388 *
10389 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10390 *
10391 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10392 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10393 *
10394 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10395 */
10396void
10397process_proxy_new_for_bus (
10398 GBusType bus_type,
10399 GDBusProxyFlags flags,
10400 const gchar *name,
10401 const gchar *object_path,
10402 GCancellable *cancellable,
10403 GAsyncReadyCallback callback,
10404 gpointer user_data)
10405{
10406 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);
10407}
10408
10409/**
10410 * process_proxy_new_for_bus_finish:
10411 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10412 * @error: Return location for error or %NULL
10413 *
10414 * Finishes an operation started with process_proxy_new_for_bus().
10415 *
10416 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10417 */
10418Process *
10419process_proxy_new_for_bus_finish (
10420 GAsyncResult *res,
10421 GError **error)
10422{
10423 GObject *ret;
10424 GObject *source_object;
10425 source_object = g_async_result_get_source_object (res);
10426 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10427 g_object_unref (source_object);
10428 if (ret != NULL)
10429 return PROCESS (ret);
10430 else
10431 return NULL;
10432}
10433
10434/**
10435 * process_proxy_new_for_bus_sync:
10436 * @bus_type: A #GBusType.
10437 * @flags: Flags from the #GDBusProxyFlags enumeration.
10438 * @name: A bus name (well-known or unique).
10439 * @object_path: An object path.
10440 * @cancellable: (allow-none): A #GCancellable or %NULL.
10441 * @error: Return location for error or %NULL
10442 *
10443 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10444 *
10445 * The calling thread is blocked until a reply is received.
10446 *
10447 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10448 *
10449 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10450 */
10451Process *
10452process_proxy_new_for_bus_sync (
10453 GBusType bus_type,
10454 GDBusProxyFlags flags,
10455 const gchar *name,
10456 const gchar *object_path,
10457 GCancellable *cancellable,
10458 GError **error)
10459{
10460 GInitable *ret;
10461 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);
10462 if (ret != NULL)
10463 return PROCESS (ret);
10464 else
10465 return NULL;
10466}
10467
10468
10469/* ------------------------------------------------------------------------ */
10470
10471/**
10472 * ProcessSkeleton:
10473 *
10474 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10475 */
10476
10477/**
10478 * ProcessSkeletonClass:
10479 * @parent_class: The parent class.
10480 *
10481 * Class structure for #ProcessSkeleton.
10482 */
10483
10484struct _ProcessSkeletonPrivate
10485{
10486 GValue *properties;
10487 GList *changed_properties;
10488 GSource *changed_properties_idle_source;
10489 GMainContext *context;
10490 GMutex lock;
10491};
10492
10493static void
10494_process_skeleton_handle_method_call (
10495 GDBusConnection *connection G_GNUC_UNUSED,
10496 const gchar *sender G_GNUC_UNUSED,
10497 const gchar *object_path G_GNUC_UNUSED,
10498 const gchar *interface_name,
10499 const gchar *method_name,
10500 GVariant *parameters,
10501 GDBusMethodInvocation *invocation,
10502 gpointer user_data)
10503{
10504 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10505 _ExtendedGDBusMethodInfo *info;
10506 GVariantIter iter;
10507 GVariant *child;
10508 GValue *paramv;
10509 guint num_params;
10510 guint num_extra;
10511 guint n;
10512 guint signal_id;
10513 GValue return_value = G_VALUE_INIT;
10514 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10515 g_assert (info != NULL);
10516 num_params = g_variant_n_children (parameters);
10517 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10518 n = 0;
10519 g_value_init (&paramv[n], TYPE_PROCESS);
10520 g_value_set_object (&paramv[n++], skeleton);
10521 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10522 g_value_set_object (&paramv[n++], invocation);
10523 if (info->pass_fdlist)
10524 {
10525#ifdef G_OS_UNIX
10526 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10527 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10528#else
10529 g_assert_not_reached ();
10530#endif
10531 }
10532 g_variant_iter_init (&iter, parameters);
10533 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10534 {
10535 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10536 if (arg_info->use_gvariant)
10537 {
10538 g_value_init (&paramv[n], G_TYPE_VARIANT);
10539 g_value_set_variant (&paramv[n], child);
10540 n++;
10541 }
10542 else
10543 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10544 g_variant_unref (child);
10545 }
10546 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10547 g_value_init (&return_value, G_TYPE_BOOLEAN);
10548 g_signal_emitv (paramv, signal_id, 0, &return_value);
10549 if (!g_value_get_boolean (&return_value))
10550 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);
10551 g_value_unset (&return_value);
10552 for (n = 0; n < num_params + num_extra; n++)
10553 g_value_unset (&paramv[n]);
10554 g_free (paramv);
10555}
10556
10557static GVariant *
10558_process_skeleton_handle_get_property (
10559 GDBusConnection *connection G_GNUC_UNUSED,
10560 const gchar *sender G_GNUC_UNUSED,
10561 const gchar *object_path G_GNUC_UNUSED,
10562 const gchar *interface_name G_GNUC_UNUSED,
10563 const gchar *property_name,
10564 GError **error,
10565 gpointer user_data)
10566{
10567 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10568 GValue value = G_VALUE_INIT;
10569 GParamSpec *pspec;
10570 _ExtendedGDBusPropertyInfo *info;
10571 GVariant *ret;
10572 ret = NULL;
10573 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10574 g_assert (info != NULL);
10575 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10576 if (pspec == NULL)
10577 {
10578 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10579 }
10580 else
10581 {
10582 g_value_init (&value, pspec->value_type);
10583 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10584 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10585 g_value_unset (&value);
10586 }
10587 return ret;
10588}
10589
10590static gboolean
10591_process_skeleton_handle_set_property (
10592 GDBusConnection *connection G_GNUC_UNUSED,
10593 const gchar *sender G_GNUC_UNUSED,
10594 const gchar *object_path G_GNUC_UNUSED,
10595 const gchar *interface_name G_GNUC_UNUSED,
10596 const gchar *property_name,
10597 GVariant *variant,
10598 GError **error,
10599 gpointer user_data)
10600{
10601 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10602 GValue value = G_VALUE_INIT;
10603 GParamSpec *pspec;
10604 _ExtendedGDBusPropertyInfo *info;
10605 gboolean ret;
10606 ret = FALSE;
10607 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10608 g_assert (info != NULL);
10609 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10610 if (pspec == NULL)
10611 {
10612 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10613 }
10614 else
10615 {
10616 if (info->use_gvariant)
10617 g_value_set_variant (&value, variant);
10618 else
10619 g_dbus_gvariant_to_gvalue (variant, &value);
10620 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10621 g_value_unset (&value);
10622 ret = TRUE;
10623 }
10624 return ret;
10625}
10626
10627static const GDBusInterfaceVTable _process_skeleton_vtable =
10628{
10629 _process_skeleton_handle_method_call,
10630 _process_skeleton_handle_get_property,
10631 _process_skeleton_handle_set_property,
10632 {NULL}
10633};
10634
10635static GDBusInterfaceInfo *
10636process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10637{
10638 return process_interface_info ();
10639}
10640
10641static GDBusInterfaceVTable *
10642process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10643{
10644 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10645}
10646
10647static GVariant *
10648process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10649{
10650 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10651
10652 GVariantBuilder builder;
10653 guint n;
10654 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10655 if (_process_interface_info.parent_struct.properties == NULL)
10656 goto out;
10657 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10658 {
10659 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10660 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10661 {
10662 GVariant *value;
10663 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);
10664 if (value != NULL)
10665 {
10666 g_variant_take_ref (value);
10667 g_variant_builder_add (&builder, "{sv}", info->name, value);
10668 g_variant_unref (value);
10669 }
10670 }
10671 }
10672out:
10673 return g_variant_builder_end (&builder);
10674}
10675
10676static void
10677process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10678{
10679}
10680
10681static void process_skeleton_iface_init (ProcessIface *iface);
10682#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10683G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10684 G_ADD_PRIVATE (ProcessSkeleton)
10685 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10686
10687#else
10688G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10689 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10690
10691#endif
10692static void
10693process_skeleton_finalize (GObject *object)
10694{
10695 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10696 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10697 if (skeleton->priv->changed_properties_idle_source != NULL)
10698 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10699 g_main_context_unref (skeleton->priv->context);
10700 g_mutex_clear (&skeleton->priv->lock);
10701 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10702}
10703
10704static void
10705process_skeleton_init (ProcessSkeleton *skeleton)
10706{
10707#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10708 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10709#else
10710 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10711#endif
10712
10713 g_mutex_init (&skeleton->priv->lock);
10714 skeleton->priv->context = g_main_context_ref_thread_default ();
10715}
10716
10717static void
10718process_skeleton_class_init (ProcessSkeletonClass *klass)
10719{
10720 GObjectClass *gobject_class;
10721 GDBusInterfaceSkeletonClass *skeleton_class;
10722
10723 gobject_class = G_OBJECT_CLASS (klass);
10724 gobject_class->finalize = process_skeleton_finalize;
10725
10726 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10727 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10728 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10729 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10730 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10731
10732#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10733 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10734#endif
10735}
10736
10737static void
10738process_skeleton_iface_init (ProcessIface *iface)
10739{
10740}
10741
10742/**
10743 * process_skeleton_new:
10744 *
10745 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10746 *
10747 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10748 */
10749Process *
10750process_skeleton_new (void)
10751{
10752 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10753}
10754
10755/* ------------------------------------------------------------------------
10756 * Code for interface org.openbmc.Control
10757 * ------------------------------------------------------------------------
10758 */
10759
10760/**
10761 * SECTION:Control
10762 * @title: Control
10763 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
10764 *
10765 * 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.
10766 */
10767
10768/* ---- Introspection data for org.openbmc.Control ---- */
10769
10770static const _ExtendedGDBusMethodInfo _control_method_info_init =
10771{
10772 {
10773 -1,
10774 (gchar *) "init",
10775 NULL,
10776 NULL,
10777 NULL
10778 },
10779 "handle-init",
10780 FALSE
10781};
10782
10783static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
10784{
10785 &_control_method_info_init,
10786 NULL
10787};
10788
10789static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
10790{
10791 {
10792 -1,
10793 (gchar *) "bus_name",
10794 (gchar *) "s",
10795 NULL
10796 },
10797 FALSE
10798};
10799
10800static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
10801{
10802 &_control_signal_info_heartbeat_ARG_bus_name,
10803 NULL
10804};
10805
10806static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
10807{
10808 {
10809 -1,
10810 (gchar *) "Heartbeat",
10811 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
10812 NULL
10813 },
10814 "heartbeat"
10815};
10816
10817static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
10818{
10819 {
10820 -1,
10821 (gchar *) "state_name",
10822 (gchar *) "s",
10823 NULL
10824 },
10825 FALSE
10826};
10827
10828static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
10829{
10830 &_control_signal_info_goto_system_state_ARG_state_name,
10831 NULL
10832};
10833
10834static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
10835{
10836 {
10837 -1,
10838 (gchar *) "GotoSystemState",
10839 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
10840 NULL
10841 },
10842 "goto-system-state"
10843};
10844
10845static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
10846{
10847 &_control_signal_info_heartbeat,
10848 &_control_signal_info_goto_system_state,
10849 NULL
10850};
10851
10852static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
10853{
10854 {
10855 -1,
10856 (gchar *) "poll_interval",
10857 (gchar *) "i",
10858 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
10859 NULL
10860 },
10861 "poll-interval",
10862 FALSE
10863};
10864
10865static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
10866{
10867 {
10868 -1,
10869 (gchar *) "heatbeat",
10870 (gchar *) "i",
10871 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10872 NULL
10873 },
10874 "heatbeat",
10875 FALSE
10876};
10877
10878static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
10879{
10880 &_control_property_info_poll_interval,
10881 &_control_property_info_heatbeat,
10882 NULL
10883};
10884
10885static const _ExtendedGDBusInterfaceInfo _control_interface_info =
10886{
10887 {
10888 -1,
10889 (gchar *) "org.openbmc.Control",
10890 (GDBusMethodInfo **) &_control_method_info_pointers,
10891 (GDBusSignalInfo **) &_control_signal_info_pointers,
10892 (GDBusPropertyInfo **) &_control_property_info_pointers,
10893 NULL
10894 },
10895 "control",
10896};
10897
10898
10899/**
10900 * control_interface_info:
10901 *
10902 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
10903 *
10904 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10905 */
10906GDBusInterfaceInfo *
10907control_interface_info (void)
10908{
10909 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
10910}
10911
10912/**
10913 * control_override_properties:
10914 * @klass: The class structure for a #GObject<!-- -->-derived class.
10915 * @property_id_begin: The property id to assign to the first overridden property.
10916 *
10917 * Overrides all #GObject properties in the #Control interface for a concrete class.
10918 * The properties are overridden in the order they are defined.
10919 *
10920 * Returns: The last property id.
10921 */
10922guint
10923control_override_properties (GObjectClass *klass, guint property_id_begin)
10924{
10925 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
10926 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
10927 return property_id_begin - 1;
10928}
10929
10930
10931
10932/**
10933 * Control:
10934 *
10935 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
10936 */
10937
10938/**
10939 * ControlIface:
10940 * @parent_iface: The parent interface.
10941 * @handle_init: Handler for the #Control::handle-init signal.
10942 * @get_heatbeat: Getter for the #Control:heatbeat property.
10943 * @get_poll_interval: Getter for the #Control:poll-interval property.
10944 * @goto_system_state: Handler for the #Control::goto-system-state signal.
10945 * @heartbeat: Handler for the #Control::heartbeat signal.
10946 *
10947 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
10948 */
10949
10950typedef ControlIface ControlInterface;
10951G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
10952
10953static void
10954control_default_init (ControlIface *iface)
10955{
10956 /* GObject signals for incoming D-Bus method calls: */
10957 /**
10958 * Control::handle-init:
10959 * @object: A #Control.
10960 * @invocation: A #GDBusMethodInvocation.
10961 *
10962 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
10963 *
10964 * 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.
10965 *
10966 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10967 */
10968 g_signal_new ("handle-init",
10969 G_TYPE_FROM_INTERFACE (iface),
10970 G_SIGNAL_RUN_LAST,
10971 G_STRUCT_OFFSET (ControlIface, handle_init),
10972 g_signal_accumulator_true_handled,
10973 NULL,
10974 g_cclosure_marshal_generic,
10975 G_TYPE_BOOLEAN,
10976 1,
10977 G_TYPE_DBUS_METHOD_INVOCATION);
10978
10979 /* GObject signals for received D-Bus signals: */
10980 /**
10981 * Control::heartbeat:
10982 * @object: A #Control.
10983 * @arg_bus_name: Argument.
10984 *
10985 * 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.
10986 *
10987 * 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.
10988 */
10989 g_signal_new ("heartbeat",
10990 G_TYPE_FROM_INTERFACE (iface),
10991 G_SIGNAL_RUN_LAST,
10992 G_STRUCT_OFFSET (ControlIface, heartbeat),
10993 NULL,
10994 NULL,
10995 g_cclosure_marshal_generic,
10996 G_TYPE_NONE,
10997 1, G_TYPE_STRING);
10998
10999 /**
11000 * Control::goto-system-state:
11001 * @object: A #Control.
11002 * @arg_state_name: Argument.
11003 *
11004 * 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.
11005 *
11006 * 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.
11007 */
11008 g_signal_new ("goto-system-state",
11009 G_TYPE_FROM_INTERFACE (iface),
11010 G_SIGNAL_RUN_LAST,
11011 G_STRUCT_OFFSET (ControlIface, goto_system_state),
11012 NULL,
11013 NULL,
11014 g_cclosure_marshal_generic,
11015 G_TYPE_NONE,
11016 1, G_TYPE_STRING);
11017
11018 /* GObject properties for D-Bus properties: */
11019 /**
11020 * Control:poll-interval:
11021 *
11022 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
11023 *
11024 * 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.
11025 */
11026 g_object_interface_install_property (iface,
11027 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11028 /**
11029 * Control:heatbeat:
11030 *
11031 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
11032 *
11033 * 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.
11034 */
11035 g_object_interface_install_property (iface,
11036 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11037}
11038
11039/**
11040 * control_get_poll_interval: (skip)
11041 * @object: A #Control.
11042 *
11043 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
11044 *
11045 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11046 *
11047 * Returns: The property value.
11048 */
11049gint
11050control_get_poll_interval (Control *object)
11051{
11052 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
11053}
11054
11055/**
11056 * control_set_poll_interval: (skip)
11057 * @object: A #Control.
11058 * @value: The value to set.
11059 *
11060 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
11061 *
11062 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11063 */
11064void
11065control_set_poll_interval (Control *object, gint value)
11066{
11067 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
11068}
11069
11070/**
11071 * control_get_heatbeat: (skip)
11072 * @object: A #Control.
11073 *
11074 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
11075 *
11076 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11077 *
11078 * Returns: The property value.
11079 */
11080gint
11081control_get_heatbeat (Control *object)
11082{
11083 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
11084}
11085
11086/**
11087 * control_set_heatbeat: (skip)
11088 * @object: A #Control.
11089 * @value: The value to set.
11090 *
11091 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
11092 *
11093 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11094 */
11095void
11096control_set_heatbeat (Control *object, gint value)
11097{
11098 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
11099}
11100
11101/**
11102 * control_emit_heartbeat:
11103 * @object: A #Control.
11104 * @arg_bus_name: Argument to pass with the signal.
11105 *
11106 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
11107 */
11108void
11109control_emit_heartbeat (
11110 Control *object,
11111 const gchar *arg_bus_name)
11112{
11113 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
11114}
11115
11116/**
11117 * control_emit_goto_system_state:
11118 * @object: A #Control.
11119 * @arg_state_name: Argument to pass with the signal.
11120 *
11121 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
11122 */
11123void
11124control_emit_goto_system_state (
11125 Control *object,
11126 const gchar *arg_state_name)
11127{
11128 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
11129}
11130
11131/**
11132 * control_call_init:
11133 * @proxy: A #ControlProxy.
11134 * @cancellable: (allow-none): A #GCancellable or %NULL.
11135 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11136 * @user_data: User data to pass to @callback.
11137 *
11138 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
11139 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11140 * You can then call control_call_init_finish() to get the result of the operation.
11141 *
11142 * See control_call_init_sync() for the synchronous, blocking version of this method.
11143 */
11144void
11145control_call_init (
11146 Control *proxy,
11147 GCancellable *cancellable,
11148 GAsyncReadyCallback callback,
11149 gpointer user_data)
11150{
11151 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11152 "init",
11153 g_variant_new ("()"),
11154 G_DBUS_CALL_FLAGS_NONE,
11155 -1,
11156 cancellable,
11157 callback,
11158 user_data);
11159}
11160
11161/**
11162 * control_call_init_finish:
11163 * @proxy: A #ControlProxy.
11164 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
11165 * @error: Return location for error or %NULL.
11166 *
11167 * Finishes an operation started with control_call_init().
11168 *
11169 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11170 */
11171gboolean
11172control_call_init_finish (
11173 Control *proxy,
11174 GAsyncResult *res,
11175 GError **error)
11176{
11177 GVariant *_ret;
11178 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11179 if (_ret == NULL)
11180 goto _out;
11181 g_variant_get (_ret,
11182 "()");
11183 g_variant_unref (_ret);
11184_out:
11185 return _ret != NULL;
11186}
11187
11188/**
11189 * control_call_init_sync:
11190 * @proxy: A #ControlProxy.
11191 * @cancellable: (allow-none): A #GCancellable or %NULL.
11192 * @error: Return location for error or %NULL.
11193 *
11194 * 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.
11195 *
11196 * See control_call_init() for the asynchronous version of this method.
11197 *
11198 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11199 */
11200gboolean
11201control_call_init_sync (
11202 Control *proxy,
11203 GCancellable *cancellable,
11204 GError **error)
11205{
11206 GVariant *_ret;
11207 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11208 "init",
11209 g_variant_new ("()"),
11210 G_DBUS_CALL_FLAGS_NONE,
11211 -1,
11212 cancellable,
11213 error);
11214 if (_ret == NULL)
11215 goto _out;
11216 g_variant_get (_ret,
11217 "()");
11218 g_variant_unref (_ret);
11219_out:
11220 return _ret != NULL;
11221}
11222
11223/**
11224 * control_complete_init:
11225 * @object: A #Control.
11226 * @invocation: (transfer full): A #GDBusMethodInvocation.
11227 *
11228 * 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.
11229 *
11230 * This method will free @invocation, you cannot use it afterwards.
11231 */
11232void
11233control_complete_init (
11234 Control *object,
11235 GDBusMethodInvocation *invocation)
11236{
11237 g_dbus_method_invocation_return_value (invocation,
11238 g_variant_new ("()"));
11239}
11240
11241/* ------------------------------------------------------------------------ */
11242
11243/**
11244 * ControlProxy:
11245 *
11246 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
11247 */
11248
11249/**
11250 * ControlProxyClass:
11251 * @parent_class: The parent class.
11252 *
11253 * Class structure for #ControlProxy.
11254 */
11255
11256struct _ControlProxyPrivate
11257{
11258 GData *qdata;
11259};
11260
11261static void control_proxy_iface_init (ControlIface *iface);
11262
11263#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11264G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11265 G_ADD_PRIVATE (ControlProxy)
11266 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11267
11268#else
11269G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11270 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11271
11272#endif
11273static void
11274control_proxy_finalize (GObject *object)
11275{
11276 ControlProxy *proxy = CONTROL_PROXY (object);
11277 g_datalist_clear (&proxy->priv->qdata);
11278 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
11279}
11280
11281static void
11282control_proxy_get_property (GObject *object,
11283 guint prop_id,
11284 GValue *value,
11285 GParamSpec *pspec G_GNUC_UNUSED)
11286{
11287 const _ExtendedGDBusPropertyInfo *info;
11288 GVariant *variant;
11289 g_assert (prop_id != 0 && prop_id - 1 < 2);
11290 info = _control_property_info_pointers[prop_id - 1];
11291 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11292 if (info->use_gvariant)
11293 {
11294 g_value_set_variant (value, variant);
11295 }
11296 else
11297 {
11298 if (variant != NULL)
11299 g_dbus_gvariant_to_gvalue (variant, value);
11300 }
11301 if (variant != NULL)
11302 g_variant_unref (variant);
11303}
11304
11305static void
11306control_proxy_set_property_cb (GDBusProxy *proxy,
11307 GAsyncResult *res,
11308 gpointer user_data)
11309{
11310 const _ExtendedGDBusPropertyInfo *info = user_data;
11311 GError *error;
11312 GVariant *_ret;
11313 error = NULL;
11314 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11315 if (!_ret)
11316 {
11317 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
11318 info->parent_struct.name,
11319 error->message, g_quark_to_string (error->domain), error->code);
11320 g_error_free (error);
11321 }
11322 else
11323 {
11324 g_variant_unref (_ret);
11325 }
11326}
11327
11328static void
11329control_proxy_set_property (GObject *object,
11330 guint prop_id,
11331 const GValue *value,
11332 GParamSpec *pspec G_GNUC_UNUSED)
11333{
11334 const _ExtendedGDBusPropertyInfo *info;
11335 GVariant *variant;
11336 g_assert (prop_id != 0 && prop_id - 1 < 2);
11337 info = _control_property_info_pointers[prop_id - 1];
11338 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11339 g_dbus_proxy_call (G_DBUS_PROXY (object),
11340 "org.freedesktop.DBus.Properties.Set",
11341 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
11342 G_DBUS_CALL_FLAGS_NONE,
11343 -1,
11344 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11345 g_variant_unref (variant);
11346}
11347
11348static void
11349control_proxy_g_signal (GDBusProxy *proxy,
11350 const gchar *sender_name G_GNUC_UNUSED,
11351 const gchar *signal_name,
11352 GVariant *parameters)
11353{
11354 _ExtendedGDBusSignalInfo *info;
11355 GVariantIter iter;
11356 GVariant *child;
11357 GValue *paramv;
11358 guint num_params;
11359 guint n;
11360 guint signal_id;
11361 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
11362 if (info == NULL)
11363 return;
11364 num_params = g_variant_n_children (parameters);
11365 paramv = g_new0 (GValue, num_params + 1);
11366 g_value_init (&paramv[0], TYPE_CONTROL);
11367 g_value_set_object (&paramv[0], proxy);
11368 g_variant_iter_init (&iter, parameters);
11369 n = 1;
11370 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11371 {
11372 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11373 if (arg_info->use_gvariant)
11374 {
11375 g_value_init (&paramv[n], G_TYPE_VARIANT);
11376 g_value_set_variant (&paramv[n], child);
11377 n++;
11378 }
11379 else
11380 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11381 g_variant_unref (child);
11382 }
11383 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11384 g_signal_emitv (paramv, signal_id, 0, NULL);
11385 for (n = 0; n < num_params + 1; n++)
11386 g_value_unset (&paramv[n]);
11387 g_free (paramv);
11388}
11389
11390static void
11391control_proxy_g_properties_changed (GDBusProxy *_proxy,
11392 GVariant *changed_properties,
11393 const gchar *const *invalidated_properties)
11394{
11395 ControlProxy *proxy = CONTROL_PROXY (_proxy);
11396 guint n;
11397 const gchar *key;
11398 GVariantIter *iter;
11399 _ExtendedGDBusPropertyInfo *info;
11400 g_variant_get (changed_properties, "a{sv}", &iter);
11401 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11402 {
11403 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
11404 g_datalist_remove_data (&proxy->priv->qdata, key);
11405 if (info != NULL)
11406 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11407 }
11408 g_variant_iter_free (iter);
11409 for (n = 0; invalidated_properties[n] != NULL; n++)
11410 {
11411 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
11412 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11413 if (info != NULL)
11414 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11415 }
11416}
11417
11418static gint
11419control_proxy_get_poll_interval (Control *object)
11420{
11421 ControlProxy *proxy = CONTROL_PROXY (object);
11422 GVariant *variant;
11423 gint value = 0;
11424 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
11425 if (variant != NULL)
11426 {
11427 value = g_variant_get_int32 (variant);
11428 g_variant_unref (variant);
11429 }
11430 return value;
11431}
11432
11433static gint
11434control_proxy_get_heatbeat (Control *object)
11435{
11436 ControlProxy *proxy = CONTROL_PROXY (object);
11437 GVariant *variant;
11438 gint value = 0;
11439 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
11440 if (variant != NULL)
11441 {
11442 value = g_variant_get_int32 (variant);
11443 g_variant_unref (variant);
11444 }
11445 return value;
11446}
11447
11448static void
11449control_proxy_init (ControlProxy *proxy)
11450{
11451#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11452 proxy->priv = control_proxy_get_instance_private (proxy);
11453#else
11454 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
11455#endif
11456
11457 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
11458}
11459
11460static void
11461control_proxy_class_init (ControlProxyClass *klass)
11462{
11463 GObjectClass *gobject_class;
11464 GDBusProxyClass *proxy_class;
11465
11466 gobject_class = G_OBJECT_CLASS (klass);
11467 gobject_class->finalize = control_proxy_finalize;
11468 gobject_class->get_property = control_proxy_get_property;
11469 gobject_class->set_property = control_proxy_set_property;
11470
11471 proxy_class = G_DBUS_PROXY_CLASS (klass);
11472 proxy_class->g_signal = control_proxy_g_signal;
11473 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
11474
11475 control_override_properties (gobject_class, 1);
11476
11477#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11478 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
11479#endif
11480}
11481
11482static void
11483control_proxy_iface_init (ControlIface *iface)
11484{
11485 iface->get_poll_interval = control_proxy_get_poll_interval;
11486 iface->get_heatbeat = control_proxy_get_heatbeat;
11487}
11488
11489/**
11490 * control_proxy_new:
11491 * @connection: A #GDBusConnection.
11492 * @flags: Flags from the #GDBusProxyFlags enumeration.
11493 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11494 * @object_path: An object path.
11495 * @cancellable: (allow-none): A #GCancellable or %NULL.
11496 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11497 * @user_data: User data to pass to @callback.
11498 *
11499 * 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.
11500 *
11501 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11502 * You can then call control_proxy_new_finish() to get the result of the operation.
11503 *
11504 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
11505 */
11506void
11507control_proxy_new (
11508 GDBusConnection *connection,
11509 GDBusProxyFlags flags,
11510 const gchar *name,
11511 const gchar *object_path,
11512 GCancellable *cancellable,
11513 GAsyncReadyCallback callback,
11514 gpointer user_data)
11515{
11516 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);
11517}
11518
11519/**
11520 * control_proxy_new_finish:
11521 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
11522 * @error: Return location for error or %NULL
11523 *
11524 * Finishes an operation started with control_proxy_new().
11525 *
11526 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11527 */
11528Control *
11529control_proxy_new_finish (
11530 GAsyncResult *res,
11531 GError **error)
11532{
11533 GObject *ret;
11534 GObject *source_object;
11535 source_object = g_async_result_get_source_object (res);
11536 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11537 g_object_unref (source_object);
11538 if (ret != NULL)
11539 return CONTROL (ret);
11540 else
11541 return NULL;
11542}
11543
11544/**
11545 * control_proxy_new_sync:
11546 * @connection: A #GDBusConnection.
11547 * @flags: Flags from the #GDBusProxyFlags enumeration.
11548 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11549 * @object_path: An object path.
11550 * @cancellable: (allow-none): A #GCancellable or %NULL.
11551 * @error: Return location for error or %NULL
11552 *
11553 * 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.
11554 *
11555 * The calling thread is blocked until a reply is received.
11556 *
11557 * See control_proxy_new() for the asynchronous version of this constructor.
11558 *
11559 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11560 */
11561Control *
11562control_proxy_new_sync (
11563 GDBusConnection *connection,
11564 GDBusProxyFlags flags,
11565 const gchar *name,
11566 const gchar *object_path,
11567 GCancellable *cancellable,
11568 GError **error)
11569{
11570 GInitable *ret;
11571 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);
11572 if (ret != NULL)
11573 return CONTROL (ret);
11574 else
11575 return NULL;
11576}
11577
11578
11579/**
11580 * control_proxy_new_for_bus:
11581 * @bus_type: A #GBusType.
11582 * @flags: Flags from the #GDBusProxyFlags enumeration.
11583 * @name: A bus name (well-known or unique).
11584 * @object_path: An object path.
11585 * @cancellable: (allow-none): A #GCancellable or %NULL.
11586 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11587 * @user_data: User data to pass to @callback.
11588 *
11589 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11590 *
11591 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11592 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
11593 *
11594 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11595 */
11596void
11597control_proxy_new_for_bus (
11598 GBusType bus_type,
11599 GDBusProxyFlags flags,
11600 const gchar *name,
11601 const gchar *object_path,
11602 GCancellable *cancellable,
11603 GAsyncReadyCallback callback,
11604 gpointer user_data)
11605{
11606 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);
11607}
11608
11609/**
11610 * control_proxy_new_for_bus_finish:
11611 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
11612 * @error: Return location for error or %NULL
11613 *
11614 * Finishes an operation started with control_proxy_new_for_bus().
11615 *
11616 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11617 */
11618Control *
11619control_proxy_new_for_bus_finish (
11620 GAsyncResult *res,
11621 GError **error)
11622{
11623 GObject *ret;
11624 GObject *source_object;
11625 source_object = g_async_result_get_source_object (res);
11626 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11627 g_object_unref (source_object);
11628 if (ret != NULL)
11629 return CONTROL (ret);
11630 else
11631 return NULL;
11632}
11633
11634/**
11635 * control_proxy_new_for_bus_sync:
11636 * @bus_type: A #GBusType.
11637 * @flags: Flags from the #GDBusProxyFlags enumeration.
11638 * @name: A bus name (well-known or unique).
11639 * @object_path: An object path.
11640 * @cancellable: (allow-none): A #GCancellable or %NULL.
11641 * @error: Return location for error or %NULL
11642 *
11643 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11644 *
11645 * The calling thread is blocked until a reply is received.
11646 *
11647 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
11648 *
11649 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11650 */
11651Control *
11652control_proxy_new_for_bus_sync (
11653 GBusType bus_type,
11654 GDBusProxyFlags flags,
11655 const gchar *name,
11656 const gchar *object_path,
11657 GCancellable *cancellable,
11658 GError **error)
11659{
11660 GInitable *ret;
11661 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);
11662 if (ret != NULL)
11663 return CONTROL (ret);
11664 else
11665 return NULL;
11666}
11667
11668
11669/* ------------------------------------------------------------------------ */
11670
11671/**
11672 * ControlSkeleton:
11673 *
11674 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
11675 */
11676
11677/**
11678 * ControlSkeletonClass:
11679 * @parent_class: The parent class.
11680 *
11681 * Class structure for #ControlSkeleton.
11682 */
11683
11684struct _ControlSkeletonPrivate
11685{
11686 GValue *properties;
11687 GList *changed_properties;
11688 GSource *changed_properties_idle_source;
11689 GMainContext *context;
11690 GMutex lock;
11691};
11692
11693static void
11694_control_skeleton_handle_method_call (
11695 GDBusConnection *connection G_GNUC_UNUSED,
11696 const gchar *sender G_GNUC_UNUSED,
11697 const gchar *object_path G_GNUC_UNUSED,
11698 const gchar *interface_name,
11699 const gchar *method_name,
11700 GVariant *parameters,
11701 GDBusMethodInvocation *invocation,
11702 gpointer user_data)
11703{
11704 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11705 _ExtendedGDBusMethodInfo *info;
11706 GVariantIter iter;
11707 GVariant *child;
11708 GValue *paramv;
11709 guint num_params;
11710 guint num_extra;
11711 guint n;
11712 guint signal_id;
11713 GValue return_value = G_VALUE_INIT;
11714 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11715 g_assert (info != NULL);
11716 num_params = g_variant_n_children (parameters);
11717 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11718 n = 0;
11719 g_value_init (&paramv[n], TYPE_CONTROL);
11720 g_value_set_object (&paramv[n++], skeleton);
11721 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11722 g_value_set_object (&paramv[n++], invocation);
11723 if (info->pass_fdlist)
11724 {
11725#ifdef G_OS_UNIX
11726 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11727 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11728#else
11729 g_assert_not_reached ();
11730#endif
11731 }
11732 g_variant_iter_init (&iter, parameters);
11733 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11734 {
11735 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11736 if (arg_info->use_gvariant)
11737 {
11738 g_value_init (&paramv[n], G_TYPE_VARIANT);
11739 g_value_set_variant (&paramv[n], child);
11740 n++;
11741 }
11742 else
11743 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11744 g_variant_unref (child);
11745 }
11746 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11747 g_value_init (&return_value, G_TYPE_BOOLEAN);
11748 g_signal_emitv (paramv, signal_id, 0, &return_value);
11749 if (!g_value_get_boolean (&return_value))
11750 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);
11751 g_value_unset (&return_value);
11752 for (n = 0; n < num_params + num_extra; n++)
11753 g_value_unset (&paramv[n]);
11754 g_free (paramv);
11755}
11756
11757static GVariant *
11758_control_skeleton_handle_get_property (
11759 GDBusConnection *connection G_GNUC_UNUSED,
11760 const gchar *sender G_GNUC_UNUSED,
11761 const gchar *object_path G_GNUC_UNUSED,
11762 const gchar *interface_name G_GNUC_UNUSED,
11763 const gchar *property_name,
11764 GError **error,
11765 gpointer user_data)
11766{
11767 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11768 GValue value = G_VALUE_INIT;
11769 GParamSpec *pspec;
11770 _ExtendedGDBusPropertyInfo *info;
11771 GVariant *ret;
11772 ret = NULL;
11773 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11774 g_assert (info != NULL);
11775 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11776 if (pspec == NULL)
11777 {
11778 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11779 }
11780 else
11781 {
11782 g_value_init (&value, pspec->value_type);
11783 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11784 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11785 g_value_unset (&value);
11786 }
11787 return ret;
11788}
11789
11790static gboolean
11791_control_skeleton_handle_set_property (
11792 GDBusConnection *connection G_GNUC_UNUSED,
11793 const gchar *sender G_GNUC_UNUSED,
11794 const gchar *object_path G_GNUC_UNUSED,
11795 const gchar *interface_name G_GNUC_UNUSED,
11796 const gchar *property_name,
11797 GVariant *variant,
11798 GError **error,
11799 gpointer user_data)
11800{
11801 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11802 GValue value = G_VALUE_INIT;
11803 GParamSpec *pspec;
11804 _ExtendedGDBusPropertyInfo *info;
11805 gboolean ret;
11806 ret = FALSE;
11807 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11808 g_assert (info != NULL);
11809 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11810 if (pspec == NULL)
11811 {
11812 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11813 }
11814 else
11815 {
11816 if (info->use_gvariant)
11817 g_value_set_variant (&value, variant);
11818 else
11819 g_dbus_gvariant_to_gvalue (variant, &value);
11820 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11821 g_value_unset (&value);
11822 ret = TRUE;
11823 }
11824 return ret;
11825}
11826
11827static const GDBusInterfaceVTable _control_skeleton_vtable =
11828{
11829 _control_skeleton_handle_method_call,
11830 _control_skeleton_handle_get_property,
11831 _control_skeleton_handle_set_property,
11832 {NULL}
11833};
11834
11835static GDBusInterfaceInfo *
11836control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11837{
11838 return control_interface_info ();
11839}
11840
11841static GDBusInterfaceVTable *
11842control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11843{
11844 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
11845}
11846
11847static GVariant *
11848control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11849{
11850 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
11851
11852 GVariantBuilder builder;
11853 guint n;
11854 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11855 if (_control_interface_info.parent_struct.properties == NULL)
11856 goto out;
11857 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
11858 {
11859 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
11860 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11861 {
11862 GVariant *value;
11863 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);
11864 if (value != NULL)
11865 {
11866 g_variant_take_ref (value);
11867 g_variant_builder_add (&builder, "{sv}", info->name, value);
11868 g_variant_unref (value);
11869 }
11870 }
11871 }
11872out:
11873 return g_variant_builder_end (&builder);
11874}
11875
11876static gboolean _control_emit_changed (gpointer user_data);
11877
11878static void
11879control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11880{
11881 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
11882 gboolean emit_changed = FALSE;
11883
11884 g_mutex_lock (&skeleton->priv->lock);
11885 if (skeleton->priv->changed_properties_idle_source != NULL)
11886 {
11887 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11888 skeleton->priv->changed_properties_idle_source = NULL;
11889 emit_changed = TRUE;
11890 }
11891 g_mutex_unlock (&skeleton->priv->lock);
11892
11893 if (emit_changed)
11894 _control_emit_changed (skeleton);
11895}
11896
11897static void
11898_control_on_signal_heartbeat (
11899 Control *object,
11900 const gchar *arg_bus_name)
11901{
11902 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11903
11904 GList *connections, *l;
11905 GVariant *signal_variant;
11906 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
11907
11908 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
11909 arg_bus_name));
11910 for (l = connections; l != NULL; l = l->next)
11911 {
11912 GDBusConnection *connection = l->data;
11913 g_dbus_connection_emit_signal (connection,
11914 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
11915 signal_variant, NULL);
11916 }
11917 g_variant_unref (signal_variant);
11918 g_list_free_full (connections, g_object_unref);
11919}
11920
11921static void
11922_control_on_signal_goto_system_state (
11923 Control *object,
11924 const gchar *arg_state_name)
11925{
11926 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11927
11928 GList *connections, *l;
11929 GVariant *signal_variant;
11930 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
11931
11932 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
11933 arg_state_name));
11934 for (l = connections; l != NULL; l = l->next)
11935 {
11936 GDBusConnection *connection = l->data;
11937 g_dbus_connection_emit_signal (connection,
11938 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
11939 signal_variant, NULL);
11940 }
11941 g_variant_unref (signal_variant);
11942 g_list_free_full (connections, g_object_unref);
11943}
11944
11945static void control_skeleton_iface_init (ControlIface *iface);
11946#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11947G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11948 G_ADD_PRIVATE (ControlSkeleton)
11949 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
11950
11951#else
11952G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11953 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
11954
11955#endif
11956static void
11957control_skeleton_finalize (GObject *object)
11958{
11959 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11960 guint n;
11961 for (n = 0; n < 2; n++)
11962 g_value_unset (&skeleton->priv->properties[n]);
11963 g_free (skeleton->priv->properties);
11964 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11965 if (skeleton->priv->changed_properties_idle_source != NULL)
11966 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11967 g_main_context_unref (skeleton->priv->context);
11968 g_mutex_clear (&skeleton->priv->lock);
11969 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
11970}
11971
11972static void
11973control_skeleton_get_property (GObject *object,
11974 guint prop_id,
11975 GValue *value,
11976 GParamSpec *pspec G_GNUC_UNUSED)
11977{
11978 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11979 g_assert (prop_id != 0 && prop_id - 1 < 2);
11980 g_mutex_lock (&skeleton->priv->lock);
11981 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
11982 g_mutex_unlock (&skeleton->priv->lock);
11983}
11984
11985static gboolean
11986_control_emit_changed (gpointer user_data)
11987{
11988 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11989 GList *l;
11990 GVariantBuilder builder;
11991 GVariantBuilder invalidated_builder;
11992 guint num_changes;
11993
11994 g_mutex_lock (&skeleton->priv->lock);
11995 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11996 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
11997 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
11998 {
11999 ChangedProperty *cp = l->data;
12000 GVariant *variant;
12001 const GValue *cur_value;
12002
12003 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12004 if (!_g_value_equal (cur_value, &cp->orig_value))
12005 {
12006 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12007 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12008 g_variant_unref (variant);
12009 num_changes++;
12010 }
12011 }
12012 if (num_changes > 0)
12013 {
12014 GList *connections, *ll;
12015 GVariant *signal_variant;
12016 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
12017 &builder, &invalidated_builder));
12018 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12019 for (ll = connections; ll != NULL; ll = ll->next)
12020 {
12021 GDBusConnection *connection = ll->data;
12022
12023 g_dbus_connection_emit_signal (connection,
12024 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12025 "org.freedesktop.DBus.Properties",
12026 "PropertiesChanged",
12027 signal_variant,
12028 NULL);
12029 }
12030 g_variant_unref (signal_variant);
12031 g_list_free_full (connections, g_object_unref);
12032 }
12033 else
12034 {
12035 g_variant_builder_clear (&builder);
12036 g_variant_builder_clear (&invalidated_builder);
12037 }
12038 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12039 skeleton->priv->changed_properties = NULL;
12040 skeleton->priv->changed_properties_idle_source = NULL;
12041 g_mutex_unlock (&skeleton->priv->lock);
12042 return FALSE;
12043}
12044
12045static void
12046_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12047{
12048 ChangedProperty *cp;
12049 GList *l;
12050 cp = NULL;
12051 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12052 {
12053 ChangedProperty *i_cp = l->data;
12054 if (i_cp->info == info)
12055 {
12056 cp = i_cp;
12057 break;
12058 }
12059 }
12060 if (cp == NULL)
12061 {
12062 cp = g_new0 (ChangedProperty, 1);
12063 cp->prop_id = prop_id;
12064 cp->info = info;
12065 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12066 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12067 g_value_copy (orig_value, &cp->orig_value);
12068 }
12069}
12070
12071static void
12072control_skeleton_notify (GObject *object,
12073 GParamSpec *pspec G_GNUC_UNUSED)
12074{
12075 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12076 g_mutex_lock (&skeleton->priv->lock);
12077 if (skeleton->priv->changed_properties != NULL &&
12078 skeleton->priv->changed_properties_idle_source == NULL)
12079 {
12080 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12081 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12082 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12083 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12084 g_source_unref (skeleton->priv->changed_properties_idle_source);
12085 }
12086 g_mutex_unlock (&skeleton->priv->lock);
12087}
12088
12089static void
12090control_skeleton_set_property (GObject *object,
12091 guint prop_id,
12092 const GValue *value,
12093 GParamSpec *pspec)
12094{
12095 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12096 g_assert (prop_id != 0 && prop_id - 1 < 2);
12097 g_mutex_lock (&skeleton->priv->lock);
12098 g_object_freeze_notify (object);
12099 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12100 {
12101 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12102 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12103 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12104 g_object_notify_by_pspec (object, pspec);
12105 }
12106 g_mutex_unlock (&skeleton->priv->lock);
12107 g_object_thaw_notify (object);
12108}
12109
12110static void
12111control_skeleton_init (ControlSkeleton *skeleton)
12112{
12113#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12114 skeleton->priv = control_skeleton_get_instance_private (skeleton);
12115#else
12116 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
12117#endif
12118
12119 g_mutex_init (&skeleton->priv->lock);
12120 skeleton->priv->context = g_main_context_ref_thread_default ();
12121 skeleton->priv->properties = g_new0 (GValue, 2);
12122 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
12123 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
12124}
12125
12126static gint
12127control_skeleton_get_poll_interval (Control *object)
12128{
12129 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12130 gint value;
12131 g_mutex_lock (&skeleton->priv->lock);
12132 value = g_value_get_int (&(skeleton->priv->properties[0]));
12133 g_mutex_unlock (&skeleton->priv->lock);
12134 return value;
12135}
12136
12137static gint
12138control_skeleton_get_heatbeat (Control *object)
12139{
12140 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12141 gint value;
12142 g_mutex_lock (&skeleton->priv->lock);
12143 value = g_value_get_int (&(skeleton->priv->properties[1]));
12144 g_mutex_unlock (&skeleton->priv->lock);
12145 return value;
12146}
12147
12148static void
12149control_skeleton_class_init (ControlSkeletonClass *klass)
12150{
12151 GObjectClass *gobject_class;
12152 GDBusInterfaceSkeletonClass *skeleton_class;
12153
12154 gobject_class = G_OBJECT_CLASS (klass);
12155 gobject_class->finalize = control_skeleton_finalize;
12156 gobject_class->get_property = control_skeleton_get_property;
12157 gobject_class->set_property = control_skeleton_set_property;
12158 gobject_class->notify = control_skeleton_notify;
12159
12160
12161 control_override_properties (gobject_class, 1);
12162
12163 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12164 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
12165 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
12166 skeleton_class->flush = control_skeleton_dbus_interface_flush;
12167 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
12168
12169#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12170 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
12171#endif
12172}
12173
12174static void
12175control_skeleton_iface_init (ControlIface *iface)
12176{
12177 iface->heartbeat = _control_on_signal_heartbeat;
12178 iface->goto_system_state = _control_on_signal_goto_system_state;
12179 iface->get_poll_interval = control_skeleton_get_poll_interval;
12180 iface->get_heatbeat = control_skeleton_get_heatbeat;
12181}
12182
12183/**
12184 * control_skeleton_new:
12185 *
12186 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12187 *
12188 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
12189 */
12190Control *
12191control_skeleton_new (void)
12192{
12193 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
12194}
12195
12196/* ------------------------------------------------------------------------
12197 * Code for interface org.openbmc.control.Bmc
12198 * ------------------------------------------------------------------------
12199 */
12200
12201/**
12202 * SECTION:ControlBmc
12203 * @title: ControlBmc
12204 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
12205 *
12206 * 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.
12207 */
12208
12209/* ---- Introspection data for org.openbmc.control.Bmc ---- */
12210
12211static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
12212{
12213 {
12214 -1,
12215 (gchar *) "place_holder",
12216 NULL,
12217 NULL,
12218 NULL
12219 },
12220 "handle-place-holder",
12221 FALSE
12222};
12223
12224static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
12225{
12226 &_control_bmc_method_info_place_holder,
12227 NULL
12228};
12229
12230static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
12231{
12232 {
12233 -1,
12234 (gchar *) "org.openbmc.control.Bmc",
12235 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
12236 NULL,
12237 NULL,
12238 NULL
12239 },
12240 "control-bmc",
12241};
12242
12243
12244/**
12245 * control_bmc_interface_info:
12246 *
12247 * 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.
12248 *
12249 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12250 */
12251GDBusInterfaceInfo *
12252control_bmc_interface_info (void)
12253{
12254 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
12255}
12256
12257/**
12258 * control_bmc_override_properties:
12259 * @klass: The class structure for a #GObject<!-- -->-derived class.
12260 * @property_id_begin: The property id to assign to the first overridden property.
12261 *
12262 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
12263 * The properties are overridden in the order they are defined.
12264 *
12265 * Returns: The last property id.
12266 */
12267guint
12268control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
12269{
12270 return property_id_begin - 1;
12271}
12272
12273
12274
12275/**
12276 * ControlBmc:
12277 *
12278 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12279 */
12280
12281/**
12282 * ControlBmcIface:
12283 * @parent_iface: The parent interface.
12284 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
12285 *
12286 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12287 */
12288
12289typedef ControlBmcIface ControlBmcInterface;
12290G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
12291
12292static void
12293control_bmc_default_init (ControlBmcIface *iface)
12294{
12295 /* GObject signals for incoming D-Bus method calls: */
12296 /**
12297 * ControlBmc::handle-place-holder:
12298 * @object: A #ControlBmc.
12299 * @invocation: A #GDBusMethodInvocation.
12300 *
12301 * 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.
12302 *
12303 * 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.
12304 *
12305 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12306 */
12307 g_signal_new ("handle-place-holder",
12308 G_TYPE_FROM_INTERFACE (iface),
12309 G_SIGNAL_RUN_LAST,
12310 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
12311 g_signal_accumulator_true_handled,
12312 NULL,
12313 g_cclosure_marshal_generic,
12314 G_TYPE_BOOLEAN,
12315 1,
12316 G_TYPE_DBUS_METHOD_INVOCATION);
12317
12318}
12319
12320/**
12321 * control_bmc_call_place_holder:
12322 * @proxy: A #ControlBmcProxy.
12323 * @cancellable: (allow-none): A #GCancellable or %NULL.
12324 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12325 * @user_data: User data to pass to @callback.
12326 *
12327 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
12328 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12329 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
12330 *
12331 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
12332 */
12333void
12334control_bmc_call_place_holder (
12335 ControlBmc *proxy,
12336 GCancellable *cancellable,
12337 GAsyncReadyCallback callback,
12338 gpointer user_data)
12339{
12340 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12341 "place_holder",
12342 g_variant_new ("()"),
12343 G_DBUS_CALL_FLAGS_NONE,
12344 -1,
12345 cancellable,
12346 callback,
12347 user_data);
12348}
12349
12350/**
12351 * control_bmc_call_place_holder_finish:
12352 * @proxy: A #ControlBmcProxy.
12353 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
12354 * @error: Return location for error or %NULL.
12355 *
12356 * Finishes an operation started with control_bmc_call_place_holder().
12357 *
12358 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12359 */
12360gboolean
12361control_bmc_call_place_holder_finish (
12362 ControlBmc *proxy,
12363 GAsyncResult *res,
12364 GError **error)
12365{
12366 GVariant *_ret;
12367 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12368 if (_ret == NULL)
12369 goto _out;
12370 g_variant_get (_ret,
12371 "()");
12372 g_variant_unref (_ret);
12373_out:
12374 return _ret != NULL;
12375}
12376
12377/**
12378 * control_bmc_call_place_holder_sync:
12379 * @proxy: A #ControlBmcProxy.
12380 * @cancellable: (allow-none): A #GCancellable or %NULL.
12381 * @error: Return location for error or %NULL.
12382 *
12383 * 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.
12384 *
12385 * See control_bmc_call_place_holder() for the asynchronous version of this method.
12386 *
12387 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12388 */
12389gboolean
12390control_bmc_call_place_holder_sync (
12391 ControlBmc *proxy,
12392 GCancellable *cancellable,
12393 GError **error)
12394{
12395 GVariant *_ret;
12396 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12397 "place_holder",
12398 g_variant_new ("()"),
12399 G_DBUS_CALL_FLAGS_NONE,
12400 -1,
12401 cancellable,
12402 error);
12403 if (_ret == NULL)
12404 goto _out;
12405 g_variant_get (_ret,
12406 "()");
12407 g_variant_unref (_ret);
12408_out:
12409 return _ret != NULL;
12410}
12411
12412/**
12413 * control_bmc_complete_place_holder:
12414 * @object: A #ControlBmc.
12415 * @invocation: (transfer full): A #GDBusMethodInvocation.
12416 *
12417 * 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.
12418 *
12419 * This method will free @invocation, you cannot use it afterwards.
12420 */
12421void
12422control_bmc_complete_place_holder (
12423 ControlBmc *object,
12424 GDBusMethodInvocation *invocation)
12425{
12426 g_dbus_method_invocation_return_value (invocation,
12427 g_variant_new ("()"));
12428}
12429
12430/* ------------------------------------------------------------------------ */
12431
12432/**
12433 * ControlBmcProxy:
12434 *
12435 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
12436 */
12437
12438/**
12439 * ControlBmcProxyClass:
12440 * @parent_class: The parent class.
12441 *
12442 * Class structure for #ControlBmcProxy.
12443 */
12444
12445struct _ControlBmcProxyPrivate
12446{
12447 GData *qdata;
12448};
12449
12450static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
12451
12452#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12453G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12454 G_ADD_PRIVATE (ControlBmcProxy)
12455 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12456
12457#else
12458G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12459 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12460
12461#endif
12462static void
12463control_bmc_proxy_finalize (GObject *object)
12464{
12465 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
12466 g_datalist_clear (&proxy->priv->qdata);
12467 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
12468}
12469
12470static void
12471control_bmc_proxy_get_property (GObject *object,
12472 guint prop_id,
12473 GValue *value,
12474 GParamSpec *pspec G_GNUC_UNUSED)
12475{
12476}
12477
12478static void
12479control_bmc_proxy_set_property (GObject *object,
12480 guint prop_id,
12481 const GValue *value,
12482 GParamSpec *pspec G_GNUC_UNUSED)
12483{
12484}
12485
12486static void
12487control_bmc_proxy_g_signal (GDBusProxy *proxy,
12488 const gchar *sender_name G_GNUC_UNUSED,
12489 const gchar *signal_name,
12490 GVariant *parameters)
12491{
12492 _ExtendedGDBusSignalInfo *info;
12493 GVariantIter iter;
12494 GVariant *child;
12495 GValue *paramv;
12496 guint num_params;
12497 guint n;
12498 guint signal_id;
12499 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
12500 if (info == NULL)
12501 return;
12502 num_params = g_variant_n_children (parameters);
12503 paramv = g_new0 (GValue, num_params + 1);
12504 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
12505 g_value_set_object (&paramv[0], proxy);
12506 g_variant_iter_init (&iter, parameters);
12507 n = 1;
12508 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12509 {
12510 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12511 if (arg_info->use_gvariant)
12512 {
12513 g_value_init (&paramv[n], G_TYPE_VARIANT);
12514 g_value_set_variant (&paramv[n], child);
12515 n++;
12516 }
12517 else
12518 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12519 g_variant_unref (child);
12520 }
12521 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
12522 g_signal_emitv (paramv, signal_id, 0, NULL);
12523 for (n = 0; n < num_params + 1; n++)
12524 g_value_unset (&paramv[n]);
12525 g_free (paramv);
12526}
12527
12528static void
12529control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
12530 GVariant *changed_properties,
12531 const gchar *const *invalidated_properties)
12532{
12533 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
12534 guint n;
12535 const gchar *key;
12536 GVariantIter *iter;
12537 _ExtendedGDBusPropertyInfo *info;
12538 g_variant_get (changed_properties, "a{sv}", &iter);
12539 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12540 {
12541 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
12542 g_datalist_remove_data (&proxy->priv->qdata, key);
12543 if (info != NULL)
12544 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12545 }
12546 g_variant_iter_free (iter);
12547 for (n = 0; invalidated_properties[n] != NULL; n++)
12548 {
12549 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
12550 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12551 if (info != NULL)
12552 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12553 }
12554}
12555
12556static void
12557control_bmc_proxy_init (ControlBmcProxy *proxy)
12558{
12559#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12560 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
12561#else
12562 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
12563#endif
12564
12565 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
12566}
12567
12568static void
12569control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
12570{
12571 GObjectClass *gobject_class;
12572 GDBusProxyClass *proxy_class;
12573
12574 gobject_class = G_OBJECT_CLASS (klass);
12575 gobject_class->finalize = control_bmc_proxy_finalize;
12576 gobject_class->get_property = control_bmc_proxy_get_property;
12577 gobject_class->set_property = control_bmc_proxy_set_property;
12578
12579 proxy_class = G_DBUS_PROXY_CLASS (klass);
12580 proxy_class->g_signal = control_bmc_proxy_g_signal;
12581 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
12582
12583#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12584 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
12585#endif
12586}
12587
12588static void
12589control_bmc_proxy_iface_init (ControlBmcIface *iface)
12590{
12591}
12592
12593/**
12594 * control_bmc_proxy_new:
12595 * @connection: A #GDBusConnection.
12596 * @flags: Flags from the #GDBusProxyFlags enumeration.
12597 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12598 * @object_path: An object path.
12599 * @cancellable: (allow-none): A #GCancellable or %NULL.
12600 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12601 * @user_data: User data to pass to @callback.
12602 *
12603 * 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.
12604 *
12605 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12606 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
12607 *
12608 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
12609 */
12610void
12611control_bmc_proxy_new (
12612 GDBusConnection *connection,
12613 GDBusProxyFlags flags,
12614 const gchar *name,
12615 const gchar *object_path,
12616 GCancellable *cancellable,
12617 GAsyncReadyCallback callback,
12618 gpointer user_data)
12619{
12620 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);
12621}
12622
12623/**
12624 * control_bmc_proxy_new_finish:
12625 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
12626 * @error: Return location for error or %NULL
12627 *
12628 * Finishes an operation started with control_bmc_proxy_new().
12629 *
12630 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12631 */
12632ControlBmc *
12633control_bmc_proxy_new_finish (
12634 GAsyncResult *res,
12635 GError **error)
12636{
12637 GObject *ret;
12638 GObject *source_object;
12639 source_object = g_async_result_get_source_object (res);
12640 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12641 g_object_unref (source_object);
12642 if (ret != NULL)
12643 return CONTROL_BMC (ret);
12644 else
12645 return NULL;
12646}
12647
12648/**
12649 * control_bmc_proxy_new_sync:
12650 * @connection: A #GDBusConnection.
12651 * @flags: Flags from the #GDBusProxyFlags enumeration.
12652 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12653 * @object_path: An object path.
12654 * @cancellable: (allow-none): A #GCancellable or %NULL.
12655 * @error: Return location for error or %NULL
12656 *
12657 * 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.
12658 *
12659 * The calling thread is blocked until a reply is received.
12660 *
12661 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
12662 *
12663 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12664 */
12665ControlBmc *
12666control_bmc_proxy_new_sync (
12667 GDBusConnection *connection,
12668 GDBusProxyFlags flags,
12669 const gchar *name,
12670 const gchar *object_path,
12671 GCancellable *cancellable,
12672 GError **error)
12673{
12674 GInitable *ret;
12675 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);
12676 if (ret != NULL)
12677 return CONTROL_BMC (ret);
12678 else
12679 return NULL;
12680}
12681
12682
12683/**
12684 * control_bmc_proxy_new_for_bus:
12685 * @bus_type: A #GBusType.
12686 * @flags: Flags from the #GDBusProxyFlags enumeration.
12687 * @name: A bus name (well-known or unique).
12688 * @object_path: An object path.
12689 * @cancellable: (allow-none): A #GCancellable or %NULL.
12690 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12691 * @user_data: User data to pass to @callback.
12692 *
12693 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12694 *
12695 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12696 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
12697 *
12698 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12699 */
12700void
12701control_bmc_proxy_new_for_bus (
12702 GBusType bus_type,
12703 GDBusProxyFlags flags,
12704 const gchar *name,
12705 const gchar *object_path,
12706 GCancellable *cancellable,
12707 GAsyncReadyCallback callback,
12708 gpointer user_data)
12709{
12710 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);
12711}
12712
12713/**
12714 * control_bmc_proxy_new_for_bus_finish:
12715 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
12716 * @error: Return location for error or %NULL
12717 *
12718 * Finishes an operation started with control_bmc_proxy_new_for_bus().
12719 *
12720 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12721 */
12722ControlBmc *
12723control_bmc_proxy_new_for_bus_finish (
12724 GAsyncResult *res,
12725 GError **error)
12726{
12727 GObject *ret;
12728 GObject *source_object;
12729 source_object = g_async_result_get_source_object (res);
12730 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12731 g_object_unref (source_object);
12732 if (ret != NULL)
12733 return CONTROL_BMC (ret);
12734 else
12735 return NULL;
12736}
12737
12738/**
12739 * control_bmc_proxy_new_for_bus_sync:
12740 * @bus_type: A #GBusType.
12741 * @flags: Flags from the #GDBusProxyFlags enumeration.
12742 * @name: A bus name (well-known or unique).
12743 * @object_path: An object path.
12744 * @cancellable: (allow-none): A #GCancellable or %NULL.
12745 * @error: Return location for error or %NULL
12746 *
12747 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12748 *
12749 * The calling thread is blocked until a reply is received.
12750 *
12751 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
12752 *
12753 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12754 */
12755ControlBmc *
12756control_bmc_proxy_new_for_bus_sync (
12757 GBusType bus_type,
12758 GDBusProxyFlags flags,
12759 const gchar *name,
12760 const gchar *object_path,
12761 GCancellable *cancellable,
12762 GError **error)
12763{
12764 GInitable *ret;
12765 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);
12766 if (ret != NULL)
12767 return CONTROL_BMC (ret);
12768 else
12769 return NULL;
12770}
12771
12772
12773/* ------------------------------------------------------------------------ */
12774
12775/**
12776 * ControlBmcSkeleton:
12777 *
12778 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
12779 */
12780
12781/**
12782 * ControlBmcSkeletonClass:
12783 * @parent_class: The parent class.
12784 *
12785 * Class structure for #ControlBmcSkeleton.
12786 */
12787
12788struct _ControlBmcSkeletonPrivate
12789{
12790 GValue *properties;
12791 GList *changed_properties;
12792 GSource *changed_properties_idle_source;
12793 GMainContext *context;
12794 GMutex lock;
12795};
12796
12797static void
12798_control_bmc_skeleton_handle_method_call (
12799 GDBusConnection *connection G_GNUC_UNUSED,
12800 const gchar *sender G_GNUC_UNUSED,
12801 const gchar *object_path G_GNUC_UNUSED,
12802 const gchar *interface_name,
12803 const gchar *method_name,
12804 GVariant *parameters,
12805 GDBusMethodInvocation *invocation,
12806 gpointer user_data)
12807{
12808 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12809 _ExtendedGDBusMethodInfo *info;
12810 GVariantIter iter;
12811 GVariant *child;
12812 GValue *paramv;
12813 guint num_params;
12814 guint num_extra;
12815 guint n;
12816 guint signal_id;
12817 GValue return_value = G_VALUE_INIT;
12818 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12819 g_assert (info != NULL);
12820 num_params = g_variant_n_children (parameters);
12821 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12822 n = 0;
12823 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
12824 g_value_set_object (&paramv[n++], skeleton);
12825 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12826 g_value_set_object (&paramv[n++], invocation);
12827 if (info->pass_fdlist)
12828 {
12829#ifdef G_OS_UNIX
12830 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
12831 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
12832#else
12833 g_assert_not_reached ();
12834#endif
12835 }
12836 g_variant_iter_init (&iter, parameters);
12837 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12838 {
12839 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
12840 if (arg_info->use_gvariant)
12841 {
12842 g_value_init (&paramv[n], G_TYPE_VARIANT);
12843 g_value_set_variant (&paramv[n], child);
12844 n++;
12845 }
12846 else
12847 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12848 g_variant_unref (child);
12849 }
12850 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
12851 g_value_init (&return_value, G_TYPE_BOOLEAN);
12852 g_signal_emitv (paramv, signal_id, 0, &return_value);
12853 if (!g_value_get_boolean (&return_value))
12854 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);
12855 g_value_unset (&return_value);
12856 for (n = 0; n < num_params + num_extra; n++)
12857 g_value_unset (&paramv[n]);
12858 g_free (paramv);
12859}
12860
12861static GVariant *
12862_control_bmc_skeleton_handle_get_property (
12863 GDBusConnection *connection G_GNUC_UNUSED,
12864 const gchar *sender G_GNUC_UNUSED,
12865 const gchar *object_path G_GNUC_UNUSED,
12866 const gchar *interface_name G_GNUC_UNUSED,
12867 const gchar *property_name,
12868 GError **error,
12869 gpointer user_data)
12870{
12871 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12872 GValue value = G_VALUE_INIT;
12873 GParamSpec *pspec;
12874 _ExtendedGDBusPropertyInfo *info;
12875 GVariant *ret;
12876 ret = NULL;
12877 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
12878 g_assert (info != NULL);
12879 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12880 if (pspec == NULL)
12881 {
12882 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12883 }
12884 else
12885 {
12886 g_value_init (&value, pspec->value_type);
12887 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12888 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12889 g_value_unset (&value);
12890 }
12891 return ret;
12892}
12893
12894static gboolean
12895_control_bmc_skeleton_handle_set_property (
12896 GDBusConnection *connection G_GNUC_UNUSED,
12897 const gchar *sender G_GNUC_UNUSED,
12898 const gchar *object_path G_GNUC_UNUSED,
12899 const gchar *interface_name G_GNUC_UNUSED,
12900 const gchar *property_name,
12901 GVariant *variant,
12902 GError **error,
12903 gpointer user_data)
12904{
12905 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12906 GValue value = G_VALUE_INIT;
12907 GParamSpec *pspec;
12908 _ExtendedGDBusPropertyInfo *info;
12909 gboolean ret;
12910 ret = FALSE;
12911 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
12912 g_assert (info != NULL);
12913 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12914 if (pspec == NULL)
12915 {
12916 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12917 }
12918 else
12919 {
12920 if (info->use_gvariant)
12921 g_value_set_variant (&value, variant);
12922 else
12923 g_dbus_gvariant_to_gvalue (variant, &value);
12924 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12925 g_value_unset (&value);
12926 ret = TRUE;
12927 }
12928 return ret;
12929}
12930
12931static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
12932{
12933 _control_bmc_skeleton_handle_method_call,
12934 _control_bmc_skeleton_handle_get_property,
12935 _control_bmc_skeleton_handle_set_property,
12936 {NULL}
12937};
12938
12939static GDBusInterfaceInfo *
12940control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12941{
12942 return control_bmc_interface_info ();
12943}
12944
12945static GDBusInterfaceVTable *
12946control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12947{
12948 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
12949}
12950
12951static GVariant *
12952control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12953{
12954 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
12955
12956 GVariantBuilder builder;
12957 guint n;
12958 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12959 if (_control_bmc_interface_info.parent_struct.properties == NULL)
12960 goto out;
12961 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
12962 {
12963 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
12964 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12965 {
12966 GVariant *value;
12967 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);
12968 if (value != NULL)
12969 {
12970 g_variant_take_ref (value);
12971 g_variant_builder_add (&builder, "{sv}", info->name, value);
12972 g_variant_unref (value);
12973 }
12974 }
12975 }
12976out:
12977 return g_variant_builder_end (&builder);
12978}
12979
12980static void
12981control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12982{
12983}
12984
12985static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
12986#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12987G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12988 G_ADD_PRIVATE (ControlBmcSkeleton)
12989 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
12990
12991#else
12992G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12993 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
12994
12995#endif
12996static void
12997control_bmc_skeleton_finalize (GObject *object)
12998{
12999 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
13000 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13001 if (skeleton->priv->changed_properties_idle_source != NULL)
13002 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13003 g_main_context_unref (skeleton->priv->context);
13004 g_mutex_clear (&skeleton->priv->lock);
13005 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
13006}
13007
13008static void
13009control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
13010{
13011#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13012 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
13013#else
13014 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
13015#endif
13016
13017 g_mutex_init (&skeleton->priv->lock);
13018 skeleton->priv->context = g_main_context_ref_thread_default ();
13019}
13020
13021static void
13022control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
13023{
13024 GObjectClass *gobject_class;
13025 GDBusInterfaceSkeletonClass *skeleton_class;
13026
13027 gobject_class = G_OBJECT_CLASS (klass);
13028 gobject_class->finalize = control_bmc_skeleton_finalize;
13029
13030 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13031 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
13032 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
13033 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
13034 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
13035
13036#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13037 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
13038#endif
13039}
13040
13041static void
13042control_bmc_skeleton_iface_init (ControlBmcIface *iface)
13043{
13044}
13045
13046/**
13047 * control_bmc_skeleton_new:
13048 *
13049 * 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>.
13050 *
13051 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
13052 */
13053ControlBmc *
13054control_bmc_skeleton_new (void)
13055{
13056 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
13057}
13058
13059/* ------------------------------------------------------------------------
13060 * Code for interface org.openbmc.control.Host
13061 * ------------------------------------------------------------------------
13062 */
13063
13064/**
13065 * SECTION:ControlHost
13066 * @title: ControlHost
13067 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
13068 *
13069 * 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.
13070 */
13071
13072/* ---- Introspection data for org.openbmc.control.Host ---- */
13073
13074static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
13075{
13076 {
13077 -1,
13078 (gchar *) "boot",
13079 NULL,
13080 NULL,
13081 NULL
13082 },
13083 "handle-boot",
13084 FALSE
13085};
13086
13087static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
13088{
13089 {
13090 -1,
13091 (gchar *) "shutdown",
13092 NULL,
13093 NULL,
13094 NULL
13095 },
13096 "handle-shutdown",
13097 FALSE
13098};
13099
13100static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
13101{
13102 {
13103 -1,
13104 (gchar *) "reboot",
13105 NULL,
13106 NULL,
13107 NULL
13108 },
13109 "handle-reboot",
13110 FALSE
13111};
13112
13113static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
13114{
13115 &_control_host_method_info_boot,
13116 &_control_host_method_info_shutdown,
13117 &_control_host_method_info_reboot,
13118 NULL
13119};
13120
13121static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
13122{
13123 {
13124 -1,
13125 (gchar *) "Booted",
13126 NULL,
13127 NULL
13128 },
13129 "booted"
13130};
13131
13132static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
13133{
13134 &_control_host_signal_info_booted,
13135 NULL
13136};
13137
13138static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
13139{
13140 {
13141 -1,
13142 (gchar *) "org.openbmc.control.Host",
13143 (GDBusMethodInfo **) &_control_host_method_info_pointers,
13144 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
13145 NULL,
13146 NULL
13147 },
13148 "control-host",
13149};
13150
13151
13152/**
13153 * control_host_interface_info:
13154 *
13155 * 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.
13156 *
13157 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13158 */
13159GDBusInterfaceInfo *
13160control_host_interface_info (void)
13161{
13162 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
13163}
13164
13165/**
13166 * control_host_override_properties:
13167 * @klass: The class structure for a #GObject<!-- -->-derived class.
13168 * @property_id_begin: The property id to assign to the first overridden property.
13169 *
13170 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
13171 * The properties are overridden in the order they are defined.
13172 *
13173 * Returns: The last property id.
13174 */
13175guint
13176control_host_override_properties (GObjectClass *klass, guint property_id_begin)
13177{
13178 return property_id_begin - 1;
13179}
13180
13181
13182
13183/**
13184 * ControlHost:
13185 *
13186 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13187 */
13188
13189/**
13190 * ControlHostIface:
13191 * @parent_iface: The parent interface.
13192 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
13193 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
13194 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
13195 * @booted: Handler for the #ControlHost::booted signal.
13196 *
13197 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13198 */
13199
13200typedef ControlHostIface ControlHostInterface;
13201G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
13202
13203static void
13204control_host_default_init (ControlHostIface *iface)
13205{
13206 /* GObject signals for incoming D-Bus method calls: */
13207 /**
13208 * ControlHost::handle-boot:
13209 * @object: A #ControlHost.
13210 * @invocation: A #GDBusMethodInvocation.
13211 *
13212 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
13213 *
13214 * 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.
13215 *
13216 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13217 */
13218 g_signal_new ("handle-boot",
13219 G_TYPE_FROM_INTERFACE (iface),
13220 G_SIGNAL_RUN_LAST,
13221 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
13222 g_signal_accumulator_true_handled,
13223 NULL,
13224 g_cclosure_marshal_generic,
13225 G_TYPE_BOOLEAN,
13226 1,
13227 G_TYPE_DBUS_METHOD_INVOCATION);
13228
13229 /**
13230 * ControlHost::handle-shutdown:
13231 * @object: A #ControlHost.
13232 * @invocation: A #GDBusMethodInvocation.
13233 *
13234 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
13235 *
13236 * 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.
13237 *
13238 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13239 */
13240 g_signal_new ("handle-shutdown",
13241 G_TYPE_FROM_INTERFACE (iface),
13242 G_SIGNAL_RUN_LAST,
13243 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
13244 g_signal_accumulator_true_handled,
13245 NULL,
13246 g_cclosure_marshal_generic,
13247 G_TYPE_BOOLEAN,
13248 1,
13249 G_TYPE_DBUS_METHOD_INVOCATION);
13250
13251 /**
13252 * ControlHost::handle-reboot:
13253 * @object: A #ControlHost.
13254 * @invocation: A #GDBusMethodInvocation.
13255 *
13256 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
13257 *
13258 * 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.
13259 *
13260 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13261 */
13262 g_signal_new ("handle-reboot",
13263 G_TYPE_FROM_INTERFACE (iface),
13264 G_SIGNAL_RUN_LAST,
13265 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
13266 g_signal_accumulator_true_handled,
13267 NULL,
13268 g_cclosure_marshal_generic,
13269 G_TYPE_BOOLEAN,
13270 1,
13271 G_TYPE_DBUS_METHOD_INVOCATION);
13272
13273 /* GObject signals for received D-Bus signals: */
13274 /**
13275 * ControlHost::booted:
13276 * @object: A #ControlHost.
13277 *
13278 * 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.
13279 *
13280 * 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.
13281 */
13282 g_signal_new ("booted",
13283 G_TYPE_FROM_INTERFACE (iface),
13284 G_SIGNAL_RUN_LAST,
13285 G_STRUCT_OFFSET (ControlHostIface, booted),
13286 NULL,
13287 NULL,
13288 g_cclosure_marshal_generic,
13289 G_TYPE_NONE,
13290 0);
13291
13292}
13293
13294/**
13295 * control_host_emit_booted:
13296 * @object: A #ControlHost.
13297 *
13298 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
13299 */
13300void
13301control_host_emit_booted (
13302 ControlHost *object)
13303{
13304 g_signal_emit_by_name (object, "booted");
13305}
13306
13307/**
13308 * control_host_call_boot:
13309 * @proxy: A #ControlHostProxy.
13310 * @cancellable: (allow-none): A #GCancellable or %NULL.
13311 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13312 * @user_data: User data to pass to @callback.
13313 *
13314 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
13315 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13316 * You can then call control_host_call_boot_finish() to get the result of the operation.
13317 *
13318 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
13319 */
13320void
13321control_host_call_boot (
13322 ControlHost *proxy,
13323 GCancellable *cancellable,
13324 GAsyncReadyCallback callback,
13325 gpointer user_data)
13326{
13327 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13328 "boot",
13329 g_variant_new ("()"),
13330 G_DBUS_CALL_FLAGS_NONE,
13331 -1,
13332 cancellable,
13333 callback,
13334 user_data);
13335}
13336
13337/**
13338 * control_host_call_boot_finish:
13339 * @proxy: A #ControlHostProxy.
13340 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
13341 * @error: Return location for error or %NULL.
13342 *
13343 * Finishes an operation started with control_host_call_boot().
13344 *
13345 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13346 */
13347gboolean
13348control_host_call_boot_finish (
13349 ControlHost *proxy,
13350 GAsyncResult *res,
13351 GError **error)
13352{
13353 GVariant *_ret;
13354 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13355 if (_ret == NULL)
13356 goto _out;
13357 g_variant_get (_ret,
13358 "()");
13359 g_variant_unref (_ret);
13360_out:
13361 return _ret != NULL;
13362}
13363
13364/**
13365 * control_host_call_boot_sync:
13366 * @proxy: A #ControlHostProxy.
13367 * @cancellable: (allow-none): A #GCancellable or %NULL.
13368 * @error: Return location for error or %NULL.
13369 *
13370 * 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.
13371 *
13372 * See control_host_call_boot() for the asynchronous version of this method.
13373 *
13374 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13375 */
13376gboolean
13377control_host_call_boot_sync (
13378 ControlHost *proxy,
13379 GCancellable *cancellable,
13380 GError **error)
13381{
13382 GVariant *_ret;
13383 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13384 "boot",
13385 g_variant_new ("()"),
13386 G_DBUS_CALL_FLAGS_NONE,
13387 -1,
13388 cancellable,
13389 error);
13390 if (_ret == NULL)
13391 goto _out;
13392 g_variant_get (_ret,
13393 "()");
13394 g_variant_unref (_ret);
13395_out:
13396 return _ret != NULL;
13397}
13398
13399/**
13400 * control_host_call_shutdown:
13401 * @proxy: A #ControlHostProxy.
13402 * @cancellable: (allow-none): A #GCancellable or %NULL.
13403 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13404 * @user_data: User data to pass to @callback.
13405 *
13406 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
13407 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13408 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
13409 *
13410 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
13411 */
13412void
13413control_host_call_shutdown (
13414 ControlHost *proxy,
13415 GCancellable *cancellable,
13416 GAsyncReadyCallback callback,
13417 gpointer user_data)
13418{
13419 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13420 "shutdown",
13421 g_variant_new ("()"),
13422 G_DBUS_CALL_FLAGS_NONE,
13423 -1,
13424 cancellable,
13425 callback,
13426 user_data);
13427}
13428
13429/**
13430 * control_host_call_shutdown_finish:
13431 * @proxy: A #ControlHostProxy.
13432 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
13433 * @error: Return location for error or %NULL.
13434 *
13435 * Finishes an operation started with control_host_call_shutdown().
13436 *
13437 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13438 */
13439gboolean
13440control_host_call_shutdown_finish (
13441 ControlHost *proxy,
13442 GAsyncResult *res,
13443 GError **error)
13444{
13445 GVariant *_ret;
13446 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13447 if (_ret == NULL)
13448 goto _out;
13449 g_variant_get (_ret,
13450 "()");
13451 g_variant_unref (_ret);
13452_out:
13453 return _ret != NULL;
13454}
13455
13456/**
13457 * control_host_call_shutdown_sync:
13458 * @proxy: A #ControlHostProxy.
13459 * @cancellable: (allow-none): A #GCancellable or %NULL.
13460 * @error: Return location for error or %NULL.
13461 *
13462 * 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.
13463 *
13464 * See control_host_call_shutdown() for the asynchronous version of this method.
13465 *
13466 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13467 */
13468gboolean
13469control_host_call_shutdown_sync (
13470 ControlHost *proxy,
13471 GCancellable *cancellable,
13472 GError **error)
13473{
13474 GVariant *_ret;
13475 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13476 "shutdown",
13477 g_variant_new ("()"),
13478 G_DBUS_CALL_FLAGS_NONE,
13479 -1,
13480 cancellable,
13481 error);
13482 if (_ret == NULL)
13483 goto _out;
13484 g_variant_get (_ret,
13485 "()");
13486 g_variant_unref (_ret);
13487_out:
13488 return _ret != NULL;
13489}
13490
13491/**
13492 * control_host_call_reboot:
13493 * @proxy: A #ControlHostProxy.
13494 * @cancellable: (allow-none): A #GCancellable or %NULL.
13495 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13496 * @user_data: User data to pass to @callback.
13497 *
13498 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
13499 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13500 * You can then call control_host_call_reboot_finish() to get the result of the operation.
13501 *
13502 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
13503 */
13504void
13505control_host_call_reboot (
13506 ControlHost *proxy,
13507 GCancellable *cancellable,
13508 GAsyncReadyCallback callback,
13509 gpointer user_data)
13510{
13511 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13512 "reboot",
13513 g_variant_new ("()"),
13514 G_DBUS_CALL_FLAGS_NONE,
13515 -1,
13516 cancellable,
13517 callback,
13518 user_data);
13519}
13520
13521/**
13522 * control_host_call_reboot_finish:
13523 * @proxy: A #ControlHostProxy.
13524 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
13525 * @error: Return location for error or %NULL.
13526 *
13527 * Finishes an operation started with control_host_call_reboot().
13528 *
13529 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13530 */
13531gboolean
13532control_host_call_reboot_finish (
13533 ControlHost *proxy,
13534 GAsyncResult *res,
13535 GError **error)
13536{
13537 GVariant *_ret;
13538 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13539 if (_ret == NULL)
13540 goto _out;
13541 g_variant_get (_ret,
13542 "()");
13543 g_variant_unref (_ret);
13544_out:
13545 return _ret != NULL;
13546}
13547
13548/**
13549 * control_host_call_reboot_sync:
13550 * @proxy: A #ControlHostProxy.
13551 * @cancellable: (allow-none): A #GCancellable or %NULL.
13552 * @error: Return location for error or %NULL.
13553 *
13554 * 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.
13555 *
13556 * See control_host_call_reboot() for the asynchronous version of this method.
13557 *
13558 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13559 */
13560gboolean
13561control_host_call_reboot_sync (
13562 ControlHost *proxy,
13563 GCancellable *cancellable,
13564 GError **error)
13565{
13566 GVariant *_ret;
13567 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13568 "reboot",
13569 g_variant_new ("()"),
13570 G_DBUS_CALL_FLAGS_NONE,
13571 -1,
13572 cancellable,
13573 error);
13574 if (_ret == NULL)
13575 goto _out;
13576 g_variant_get (_ret,
13577 "()");
13578 g_variant_unref (_ret);
13579_out:
13580 return _ret != NULL;
13581}
13582
13583/**
13584 * control_host_complete_boot:
13585 * @object: A #ControlHost.
13586 * @invocation: (transfer full): A #GDBusMethodInvocation.
13587 *
13588 * 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.
13589 *
13590 * This method will free @invocation, you cannot use it afterwards.
13591 */
13592void
13593control_host_complete_boot (
13594 ControlHost *object,
13595 GDBusMethodInvocation *invocation)
13596{
13597 g_dbus_method_invocation_return_value (invocation,
13598 g_variant_new ("()"));
13599}
13600
13601/**
13602 * control_host_complete_shutdown:
13603 * @object: A #ControlHost.
13604 * @invocation: (transfer full): A #GDBusMethodInvocation.
13605 *
13606 * 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.
13607 *
13608 * This method will free @invocation, you cannot use it afterwards.
13609 */
13610void
13611control_host_complete_shutdown (
13612 ControlHost *object,
13613 GDBusMethodInvocation *invocation)
13614{
13615 g_dbus_method_invocation_return_value (invocation,
13616 g_variant_new ("()"));
13617}
13618
13619/**
13620 * control_host_complete_reboot:
13621 * @object: A #ControlHost.
13622 * @invocation: (transfer full): A #GDBusMethodInvocation.
13623 *
13624 * 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.
13625 *
13626 * This method will free @invocation, you cannot use it afterwards.
13627 */
13628void
13629control_host_complete_reboot (
13630 ControlHost *object,
13631 GDBusMethodInvocation *invocation)
13632{
13633 g_dbus_method_invocation_return_value (invocation,
13634 g_variant_new ("()"));
13635}
13636
13637/* ------------------------------------------------------------------------ */
13638
13639/**
13640 * ControlHostProxy:
13641 *
13642 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
13643 */
13644
13645/**
13646 * ControlHostProxyClass:
13647 * @parent_class: The parent class.
13648 *
13649 * Class structure for #ControlHostProxy.
13650 */
13651
13652struct _ControlHostProxyPrivate
13653{
13654 GData *qdata;
13655};
13656
13657static void control_host_proxy_iface_init (ControlHostIface *iface);
13658
13659#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13660G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13661 G_ADD_PRIVATE (ControlHostProxy)
13662 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13663
13664#else
13665G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13666 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13667
13668#endif
13669static void
13670control_host_proxy_finalize (GObject *object)
13671{
13672 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
13673 g_datalist_clear (&proxy->priv->qdata);
13674 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
13675}
13676
13677static void
13678control_host_proxy_get_property (GObject *object,
13679 guint prop_id,
13680 GValue *value,
13681 GParamSpec *pspec G_GNUC_UNUSED)
13682{
13683}
13684
13685static void
13686control_host_proxy_set_property (GObject *object,
13687 guint prop_id,
13688 const GValue *value,
13689 GParamSpec *pspec G_GNUC_UNUSED)
13690{
13691}
13692
13693static void
13694control_host_proxy_g_signal (GDBusProxy *proxy,
13695 const gchar *sender_name G_GNUC_UNUSED,
13696 const gchar *signal_name,
13697 GVariant *parameters)
13698{
13699 _ExtendedGDBusSignalInfo *info;
13700 GVariantIter iter;
13701 GVariant *child;
13702 GValue *paramv;
13703 guint num_params;
13704 guint n;
13705 guint signal_id;
13706 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
13707 if (info == NULL)
13708 return;
13709 num_params = g_variant_n_children (parameters);
13710 paramv = g_new0 (GValue, num_params + 1);
13711 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
13712 g_value_set_object (&paramv[0], proxy);
13713 g_variant_iter_init (&iter, parameters);
13714 n = 1;
13715 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13716 {
13717 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13718 if (arg_info->use_gvariant)
13719 {
13720 g_value_init (&paramv[n], G_TYPE_VARIANT);
13721 g_value_set_variant (&paramv[n], child);
13722 n++;
13723 }
13724 else
13725 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13726 g_variant_unref (child);
13727 }
13728 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
13729 g_signal_emitv (paramv, signal_id, 0, NULL);
13730 for (n = 0; n < num_params + 1; n++)
13731 g_value_unset (&paramv[n]);
13732 g_free (paramv);
13733}
13734
13735static void
13736control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
13737 GVariant *changed_properties,
13738 const gchar *const *invalidated_properties)
13739{
13740 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
13741 guint n;
13742 const gchar *key;
13743 GVariantIter *iter;
13744 _ExtendedGDBusPropertyInfo *info;
13745 g_variant_get (changed_properties, "a{sv}", &iter);
13746 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13747 {
13748 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
13749 g_datalist_remove_data (&proxy->priv->qdata, key);
13750 if (info != NULL)
13751 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13752 }
13753 g_variant_iter_free (iter);
13754 for (n = 0; invalidated_properties[n] != NULL; n++)
13755 {
13756 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
13757 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13758 if (info != NULL)
13759 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13760 }
13761}
13762
13763static void
13764control_host_proxy_init (ControlHostProxy *proxy)
13765{
13766#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13767 proxy->priv = control_host_proxy_get_instance_private (proxy);
13768#else
13769 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
13770#endif
13771
13772 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
13773}
13774
13775static void
13776control_host_proxy_class_init (ControlHostProxyClass *klass)
13777{
13778 GObjectClass *gobject_class;
13779 GDBusProxyClass *proxy_class;
13780
13781 gobject_class = G_OBJECT_CLASS (klass);
13782 gobject_class->finalize = control_host_proxy_finalize;
13783 gobject_class->get_property = control_host_proxy_get_property;
13784 gobject_class->set_property = control_host_proxy_set_property;
13785
13786 proxy_class = G_DBUS_PROXY_CLASS (klass);
13787 proxy_class->g_signal = control_host_proxy_g_signal;
13788 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
13789
13790#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13791 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
13792#endif
13793}
13794
13795static void
13796control_host_proxy_iface_init (ControlHostIface *iface)
13797{
13798}
13799
13800/**
13801 * control_host_proxy_new:
13802 * @connection: A #GDBusConnection.
13803 * @flags: Flags from the #GDBusProxyFlags enumeration.
13804 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13805 * @object_path: An object path.
13806 * @cancellable: (allow-none): A #GCancellable or %NULL.
13807 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13808 * @user_data: User data to pass to @callback.
13809 *
13810 * 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.
13811 *
13812 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13813 * You can then call control_host_proxy_new_finish() to get the result of the operation.
13814 *
13815 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
13816 */
13817void
13818control_host_proxy_new (
13819 GDBusConnection *connection,
13820 GDBusProxyFlags flags,
13821 const gchar *name,
13822 const gchar *object_path,
13823 GCancellable *cancellable,
13824 GAsyncReadyCallback callback,
13825 gpointer user_data)
13826{
13827 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);
13828}
13829
13830/**
13831 * control_host_proxy_new_finish:
13832 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
13833 * @error: Return location for error or %NULL
13834 *
13835 * Finishes an operation started with control_host_proxy_new().
13836 *
13837 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13838 */
13839ControlHost *
13840control_host_proxy_new_finish (
13841 GAsyncResult *res,
13842 GError **error)
13843{
13844 GObject *ret;
13845 GObject *source_object;
13846 source_object = g_async_result_get_source_object (res);
13847 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13848 g_object_unref (source_object);
13849 if (ret != NULL)
13850 return CONTROL_HOST (ret);
13851 else
13852 return NULL;
13853}
13854
13855/**
13856 * control_host_proxy_new_sync:
13857 * @connection: A #GDBusConnection.
13858 * @flags: Flags from the #GDBusProxyFlags enumeration.
13859 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13860 * @object_path: An object path.
13861 * @cancellable: (allow-none): A #GCancellable or %NULL.
13862 * @error: Return location for error or %NULL
13863 *
13864 * 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.
13865 *
13866 * The calling thread is blocked until a reply is received.
13867 *
13868 * See control_host_proxy_new() for the asynchronous version of this constructor.
13869 *
13870 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13871 */
13872ControlHost *
13873control_host_proxy_new_sync (
13874 GDBusConnection *connection,
13875 GDBusProxyFlags flags,
13876 const gchar *name,
13877 const gchar *object_path,
13878 GCancellable *cancellable,
13879 GError **error)
13880{
13881 GInitable *ret;
13882 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);
13883 if (ret != NULL)
13884 return CONTROL_HOST (ret);
13885 else
13886 return NULL;
13887}
13888
13889
13890/**
13891 * control_host_proxy_new_for_bus:
13892 * @bus_type: A #GBusType.
13893 * @flags: Flags from the #GDBusProxyFlags enumeration.
13894 * @name: A bus name (well-known or unique).
13895 * @object_path: An object path.
13896 * @cancellable: (allow-none): A #GCancellable or %NULL.
13897 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13898 * @user_data: User data to pass to @callback.
13899 *
13900 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13901 *
13902 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13903 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
13904 *
13905 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13906 */
13907void
13908control_host_proxy_new_for_bus (
13909 GBusType bus_type,
13910 GDBusProxyFlags flags,
13911 const gchar *name,
13912 const gchar *object_path,
13913 GCancellable *cancellable,
13914 GAsyncReadyCallback callback,
13915 gpointer user_data)
13916{
13917 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);
13918}
13919
13920/**
13921 * control_host_proxy_new_for_bus_finish:
13922 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
13923 * @error: Return location for error or %NULL
13924 *
13925 * Finishes an operation started with control_host_proxy_new_for_bus().
13926 *
13927 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13928 */
13929ControlHost *
13930control_host_proxy_new_for_bus_finish (
13931 GAsyncResult *res,
13932 GError **error)
13933{
13934 GObject *ret;
13935 GObject *source_object;
13936 source_object = g_async_result_get_source_object (res);
13937 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13938 g_object_unref (source_object);
13939 if (ret != NULL)
13940 return CONTROL_HOST (ret);
13941 else
13942 return NULL;
13943}
13944
13945/**
13946 * control_host_proxy_new_for_bus_sync:
13947 * @bus_type: A #GBusType.
13948 * @flags: Flags from the #GDBusProxyFlags enumeration.
13949 * @name: A bus name (well-known or unique).
13950 * @object_path: An object path.
13951 * @cancellable: (allow-none): A #GCancellable or %NULL.
13952 * @error: Return location for error or %NULL
13953 *
13954 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13955 *
13956 * The calling thread is blocked until a reply is received.
13957 *
13958 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
13959 *
13960 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13961 */
13962ControlHost *
13963control_host_proxy_new_for_bus_sync (
13964 GBusType bus_type,
13965 GDBusProxyFlags flags,
13966 const gchar *name,
13967 const gchar *object_path,
13968 GCancellable *cancellable,
13969 GError **error)
13970{
13971 GInitable *ret;
13972 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);
13973 if (ret != NULL)
13974 return CONTROL_HOST (ret);
13975 else
13976 return NULL;
13977}
13978
13979
13980/* ------------------------------------------------------------------------ */
13981
13982/**
13983 * ControlHostSkeleton:
13984 *
13985 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
13986 */
13987
13988/**
13989 * ControlHostSkeletonClass:
13990 * @parent_class: The parent class.
13991 *
13992 * Class structure for #ControlHostSkeleton.
13993 */
13994
13995struct _ControlHostSkeletonPrivate
13996{
13997 GValue *properties;
13998 GList *changed_properties;
13999 GSource *changed_properties_idle_source;
14000 GMainContext *context;
14001 GMutex lock;
14002};
14003
14004static void
14005_control_host_skeleton_handle_method_call (
14006 GDBusConnection *connection G_GNUC_UNUSED,
14007 const gchar *sender G_GNUC_UNUSED,
14008 const gchar *object_path G_GNUC_UNUSED,
14009 const gchar *interface_name,
14010 const gchar *method_name,
14011 GVariant *parameters,
14012 GDBusMethodInvocation *invocation,
14013 gpointer user_data)
14014{
14015 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14016 _ExtendedGDBusMethodInfo *info;
14017 GVariantIter iter;
14018 GVariant *child;
14019 GValue *paramv;
14020 guint num_params;
14021 guint num_extra;
14022 guint n;
14023 guint signal_id;
14024 GValue return_value = G_VALUE_INIT;
14025 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14026 g_assert (info != NULL);
14027 num_params = g_variant_n_children (parameters);
14028 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14029 n = 0;
14030 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
14031 g_value_set_object (&paramv[n++], skeleton);
14032 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14033 g_value_set_object (&paramv[n++], invocation);
14034 if (info->pass_fdlist)
14035 {
14036#ifdef G_OS_UNIX
14037 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14038 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14039#else
14040 g_assert_not_reached ();
14041#endif
14042 }
14043 g_variant_iter_init (&iter, parameters);
14044 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14045 {
14046 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14047 if (arg_info->use_gvariant)
14048 {
14049 g_value_init (&paramv[n], G_TYPE_VARIANT);
14050 g_value_set_variant (&paramv[n], child);
14051 n++;
14052 }
14053 else
14054 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14055 g_variant_unref (child);
14056 }
14057 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
14058 g_value_init (&return_value, G_TYPE_BOOLEAN);
14059 g_signal_emitv (paramv, signal_id, 0, &return_value);
14060 if (!g_value_get_boolean (&return_value))
14061 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);
14062 g_value_unset (&return_value);
14063 for (n = 0; n < num_params + num_extra; n++)
14064 g_value_unset (&paramv[n]);
14065 g_free (paramv);
14066}
14067
14068static GVariant *
14069_control_host_skeleton_handle_get_property (
14070 GDBusConnection *connection G_GNUC_UNUSED,
14071 const gchar *sender G_GNUC_UNUSED,
14072 const gchar *object_path G_GNUC_UNUSED,
14073 const gchar *interface_name G_GNUC_UNUSED,
14074 const gchar *property_name,
14075 GError **error,
14076 gpointer user_data)
14077{
14078 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14079 GValue value = G_VALUE_INIT;
14080 GParamSpec *pspec;
14081 _ExtendedGDBusPropertyInfo *info;
14082 GVariant *ret;
14083 ret = NULL;
14084 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14085 g_assert (info != NULL);
14086 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14087 if (pspec == NULL)
14088 {
14089 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14090 }
14091 else
14092 {
14093 g_value_init (&value, pspec->value_type);
14094 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14095 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14096 g_value_unset (&value);
14097 }
14098 return ret;
14099}
14100
14101static gboolean
14102_control_host_skeleton_handle_set_property (
14103 GDBusConnection *connection G_GNUC_UNUSED,
14104 const gchar *sender G_GNUC_UNUSED,
14105 const gchar *object_path G_GNUC_UNUSED,
14106 const gchar *interface_name G_GNUC_UNUSED,
14107 const gchar *property_name,
14108 GVariant *variant,
14109 GError **error,
14110 gpointer user_data)
14111{
14112 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14113 GValue value = G_VALUE_INIT;
14114 GParamSpec *pspec;
14115 _ExtendedGDBusPropertyInfo *info;
14116 gboolean ret;
14117 ret = FALSE;
14118 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14119 g_assert (info != NULL);
14120 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14121 if (pspec == NULL)
14122 {
14123 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14124 }
14125 else
14126 {
14127 if (info->use_gvariant)
14128 g_value_set_variant (&value, variant);
14129 else
14130 g_dbus_gvariant_to_gvalue (variant, &value);
14131 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14132 g_value_unset (&value);
14133 ret = TRUE;
14134 }
14135 return ret;
14136}
14137
14138static const GDBusInterfaceVTable _control_host_skeleton_vtable =
14139{
14140 _control_host_skeleton_handle_method_call,
14141 _control_host_skeleton_handle_get_property,
14142 _control_host_skeleton_handle_set_property,
14143 {NULL}
14144};
14145
14146static GDBusInterfaceInfo *
14147control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14148{
14149 return control_host_interface_info ();
14150}
14151
14152static GDBusInterfaceVTable *
14153control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14154{
14155 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
14156}
14157
14158static GVariant *
14159control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14160{
14161 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
14162
14163 GVariantBuilder builder;
14164 guint n;
14165 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14166 if (_control_host_interface_info.parent_struct.properties == NULL)
14167 goto out;
14168 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
14169 {
14170 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
14171 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14172 {
14173 GVariant *value;
14174 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);
14175 if (value != NULL)
14176 {
14177 g_variant_take_ref (value);
14178 g_variant_builder_add (&builder, "{sv}", info->name, value);
14179 g_variant_unref (value);
14180 }
14181 }
14182 }
14183out:
14184 return g_variant_builder_end (&builder);
14185}
14186
14187static void
14188control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14189{
14190}
14191
14192static void
14193_control_host_on_signal_booted (
14194 ControlHost *object)
14195{
14196 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14197
14198 GList *connections, *l;
14199 GVariant *signal_variant;
14200 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14201
14202 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14203 for (l = connections; l != NULL; l = l->next)
14204 {
14205 GDBusConnection *connection = l->data;
14206 g_dbus_connection_emit_signal (connection,
14207 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
14208 signal_variant, NULL);
14209 }
14210 g_variant_unref (signal_variant);
14211 g_list_free_full (connections, g_object_unref);
14212}
14213
14214static void control_host_skeleton_iface_init (ControlHostIface *iface);
14215#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14216G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14217 G_ADD_PRIVATE (ControlHostSkeleton)
14218 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14219
14220#else
14221G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14222 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14223
14224#endif
14225static void
14226control_host_skeleton_finalize (GObject *object)
14227{
14228 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14229 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14230 if (skeleton->priv->changed_properties_idle_source != NULL)
14231 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14232 g_main_context_unref (skeleton->priv->context);
14233 g_mutex_clear (&skeleton->priv->lock);
14234 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
14235}
14236
14237static void
14238control_host_skeleton_init (ControlHostSkeleton *skeleton)
14239{
14240#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14241 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
14242#else
14243 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
14244#endif
14245
14246 g_mutex_init (&skeleton->priv->lock);
14247 skeleton->priv->context = g_main_context_ref_thread_default ();
14248}
14249
14250static void
14251control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
14252{
14253 GObjectClass *gobject_class;
14254 GDBusInterfaceSkeletonClass *skeleton_class;
14255
14256 gobject_class = G_OBJECT_CLASS (klass);
14257 gobject_class->finalize = control_host_skeleton_finalize;
14258
14259 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14260 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
14261 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
14262 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
14263 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
14264
14265#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14266 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
14267#endif
14268}
14269
14270static void
14271control_host_skeleton_iface_init (ControlHostIface *iface)
14272{
14273 iface->booted = _control_host_on_signal_booted;
14274}
14275
14276/**
14277 * control_host_skeleton_new:
14278 *
14279 * 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>.
14280 *
14281 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
14282 */
14283ControlHost *
14284control_host_skeleton_new (void)
14285{
14286 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
14287}
14288
14289/* ------------------------------------------------------------------------
14290 * Code for interface org.openbmc.control.Power
14291 * ------------------------------------------------------------------------
14292 */
14293
14294/**
14295 * SECTION:ControlPower
14296 * @title: ControlPower
14297 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
14298 *
14299 * 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.
14300 */
14301
14302/* ---- Introspection data for org.openbmc.control.Power ---- */
14303
14304static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
14305{
14306 {
14307 -1,
14308 (gchar *) "state",
14309 (gchar *) "i",
14310 NULL
14311 },
14312 FALSE
14313};
14314
14315static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
14316{
14317 &_control_power_method_info_set_power_state_IN_ARG_state,
14318 NULL
14319};
14320
14321static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
14322{
14323 {
14324 -1,
14325 (gchar *) "setPowerState",
14326 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
14327 NULL,
14328 NULL
14329 },
14330 "handle-set-power-state",
14331 FALSE
14332};
14333
14334static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
14335{
14336 {
14337 -1,
14338 (gchar *) "state",
14339 (gchar *) "i",
14340 NULL
14341 },
14342 FALSE
14343};
14344
14345static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
14346{
14347 &_control_power_method_info_get_power_state_OUT_ARG_state,
14348 NULL
14349};
14350
14351static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
14352{
14353 {
14354 -1,
14355 (gchar *) "getPowerState",
14356 NULL,
14357 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
14358 NULL
14359 },
14360 "handle-get-power-state",
14361 FALSE
14362};
14363
14364static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
14365{
14366 &_control_power_method_info_set_power_state,
14367 &_control_power_method_info_get_power_state,
14368 NULL
14369};
14370
14371static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
14372{
14373 {
14374 -1,
14375 (gchar *) "PowerGood",
14376 NULL,
14377 NULL
14378 },
14379 "power-good"
14380};
14381
14382static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
14383{
14384 {
14385 -1,
14386 (gchar *) "PowerLost",
14387 NULL,
14388 NULL
14389 },
14390 "power-lost"
14391};
14392
14393static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
14394{
14395 &_control_power_signal_info_power_good,
14396 &_control_power_signal_info_power_lost,
14397 NULL
14398};
14399
14400static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
14401{
14402 {
14403 -1,
14404 (gchar *) "pgood",
14405 (gchar *) "i",
14406 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14407 NULL
14408 },
14409 "pgood",
14410 FALSE
14411};
14412
14413static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
14414{
14415 {
14416 -1,
14417 (gchar *) "state",
14418 (gchar *) "i",
14419 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14420 NULL
14421 },
14422 "state",
14423 FALSE
14424};
14425
Norman James32e74e22015-09-15 21:28:06 -050014426static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
14427{
14428 {
14429 -1,
14430 (gchar *) "pgood_timeout",
14431 (gchar *) "i",
14432 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
14433 NULL
14434 },
14435 "pgood-timeout",
14436 FALSE
14437};
14438
Norman James362a80f2015-09-14 14:04:39 -050014439static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
14440{
14441 &_control_power_property_info_pgood,
14442 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050014443 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050014444 NULL
14445};
14446
14447static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
14448{
14449 {
14450 -1,
14451 (gchar *) "org.openbmc.control.Power",
14452 (GDBusMethodInfo **) &_control_power_method_info_pointers,
14453 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
14454 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
14455 NULL
14456 },
14457 "control-power",
14458};
14459
14460
14461/**
14462 * control_power_interface_info:
14463 *
14464 * 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.
14465 *
14466 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14467 */
14468GDBusInterfaceInfo *
14469control_power_interface_info (void)
14470{
14471 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
14472}
14473
14474/**
14475 * control_power_override_properties:
14476 * @klass: The class structure for a #GObject<!-- -->-derived class.
14477 * @property_id_begin: The property id to assign to the first overridden property.
14478 *
14479 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
14480 * The properties are overridden in the order they are defined.
14481 *
14482 * Returns: The last property id.
14483 */
14484guint
14485control_power_override_properties (GObjectClass *klass, guint property_id_begin)
14486{
14487 g_object_class_override_property (klass, property_id_begin++, "pgood");
14488 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050014489 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050014490 return property_id_begin - 1;
14491}
14492
14493
14494
14495/**
14496 * ControlPower:
14497 *
14498 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14499 */
14500
14501/**
14502 * ControlPowerIface:
14503 * @parent_iface: The parent interface.
14504 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
14505 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
14506 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050014507 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050014508 * @get_state: Getter for the #ControlPower:state property.
14509 * @power_good: Handler for the #ControlPower::power-good signal.
14510 * @power_lost: Handler for the #ControlPower::power-lost signal.
14511 *
14512 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14513 */
14514
14515typedef ControlPowerIface ControlPowerInterface;
14516G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
14517
14518static void
14519control_power_default_init (ControlPowerIface *iface)
14520{
14521 /* GObject signals for incoming D-Bus method calls: */
14522 /**
14523 * ControlPower::handle-set-power-state:
14524 * @object: A #ControlPower.
14525 * @invocation: A #GDBusMethodInvocation.
14526 * @arg_state: Argument passed by remote caller.
14527 *
14528 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
14529 *
14530 * 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.
14531 *
14532 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14533 */
14534 g_signal_new ("handle-set-power-state",
14535 G_TYPE_FROM_INTERFACE (iface),
14536 G_SIGNAL_RUN_LAST,
14537 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
14538 g_signal_accumulator_true_handled,
14539 NULL,
14540 g_cclosure_marshal_generic,
14541 G_TYPE_BOOLEAN,
14542 2,
14543 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
14544
14545 /**
14546 * ControlPower::handle-get-power-state:
14547 * @object: A #ControlPower.
14548 * @invocation: A #GDBusMethodInvocation.
14549 *
14550 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
14551 *
14552 * 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.
14553 *
14554 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14555 */
14556 g_signal_new ("handle-get-power-state",
14557 G_TYPE_FROM_INTERFACE (iface),
14558 G_SIGNAL_RUN_LAST,
14559 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
14560 g_signal_accumulator_true_handled,
14561 NULL,
14562 g_cclosure_marshal_generic,
14563 G_TYPE_BOOLEAN,
14564 1,
14565 G_TYPE_DBUS_METHOD_INVOCATION);
14566
14567 /* GObject signals for received D-Bus signals: */
14568 /**
14569 * ControlPower::power-good:
14570 * @object: A #ControlPower.
14571 *
14572 * 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.
14573 *
14574 * 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.
14575 */
14576 g_signal_new ("power-good",
14577 G_TYPE_FROM_INTERFACE (iface),
14578 G_SIGNAL_RUN_LAST,
14579 G_STRUCT_OFFSET (ControlPowerIface, power_good),
14580 NULL,
14581 NULL,
14582 g_cclosure_marshal_generic,
14583 G_TYPE_NONE,
14584 0);
14585
14586 /**
14587 * ControlPower::power-lost:
14588 * @object: A #ControlPower.
14589 *
14590 * 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.
14591 *
14592 * 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.
14593 */
14594 g_signal_new ("power-lost",
14595 G_TYPE_FROM_INTERFACE (iface),
14596 G_SIGNAL_RUN_LAST,
14597 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
14598 NULL,
14599 NULL,
14600 g_cclosure_marshal_generic,
14601 G_TYPE_NONE,
14602 0);
14603
14604 /* GObject properties for D-Bus properties: */
14605 /**
14606 * ControlPower:pgood:
14607 *
14608 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
14609 *
14610 * 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.
14611 */
14612 g_object_interface_install_property (iface,
14613 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14614 /**
14615 * ControlPower:state:
14616 *
14617 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
14618 *
14619 * 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.
14620 */
14621 g_object_interface_install_property (iface,
14622 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 -050014623 /**
14624 * ControlPower:pgood-timeout:
14625 *
14626 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
14627 *
14628 * 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.
14629 */
14630 g_object_interface_install_property (iface,
14631 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 -050014632}
14633
14634/**
14635 * control_power_get_pgood: (skip)
14636 * @object: A #ControlPower.
14637 *
14638 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
14639 *
14640 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14641 *
14642 * Returns: The property value.
14643 */
14644gint
14645control_power_get_pgood (ControlPower *object)
14646{
14647 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
14648}
14649
14650/**
14651 * control_power_set_pgood: (skip)
14652 * @object: A #ControlPower.
14653 * @value: The value to set.
14654 *
14655 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
14656 *
14657 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14658 */
14659void
14660control_power_set_pgood (ControlPower *object, gint value)
14661{
14662 g_object_set (G_OBJECT (object), "pgood", value, NULL);
14663}
14664
14665/**
14666 * control_power_get_state: (skip)
14667 * @object: A #ControlPower.
14668 *
14669 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
14670 *
14671 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14672 *
14673 * Returns: The property value.
14674 */
14675gint
14676control_power_get_state (ControlPower *object)
14677{
14678 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
14679}
14680
14681/**
14682 * control_power_set_state: (skip)
14683 * @object: A #ControlPower.
14684 * @value: The value to set.
14685 *
14686 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
14687 *
14688 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14689 */
14690void
14691control_power_set_state (ControlPower *object, gint value)
14692{
14693 g_object_set (G_OBJECT (object), "state", value, NULL);
14694}
14695
14696/**
Norman James32e74e22015-09-15 21:28:06 -050014697 * control_power_get_pgood_timeout: (skip)
14698 * @object: A #ControlPower.
14699 *
14700 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
14701 *
14702 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14703 *
14704 * Returns: The property value.
14705 */
14706gint
14707control_power_get_pgood_timeout (ControlPower *object)
14708{
14709 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
14710}
14711
14712/**
14713 * control_power_set_pgood_timeout: (skip)
14714 * @object: A #ControlPower.
14715 * @value: The value to set.
14716 *
14717 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
14718 *
14719 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14720 */
14721void
14722control_power_set_pgood_timeout (ControlPower *object, gint value)
14723{
14724 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
14725}
14726
14727/**
Norman James362a80f2015-09-14 14:04:39 -050014728 * control_power_emit_power_good:
14729 * @object: A #ControlPower.
14730 *
14731 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
14732 */
14733void
14734control_power_emit_power_good (
14735 ControlPower *object)
14736{
14737 g_signal_emit_by_name (object, "power-good");
14738}
14739
14740/**
14741 * control_power_emit_power_lost:
14742 * @object: A #ControlPower.
14743 *
14744 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
14745 */
14746void
14747control_power_emit_power_lost (
14748 ControlPower *object)
14749{
14750 g_signal_emit_by_name (object, "power-lost");
14751}
14752
14753/**
14754 * control_power_call_set_power_state:
14755 * @proxy: A #ControlPowerProxy.
14756 * @arg_state: Argument to pass with the method invocation.
14757 * @cancellable: (allow-none): A #GCancellable or %NULL.
14758 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14759 * @user_data: User data to pass to @callback.
14760 *
14761 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
14762 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14763 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
14764 *
14765 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
14766 */
14767void
14768control_power_call_set_power_state (
14769 ControlPower *proxy,
14770 gint arg_state,
14771 GCancellable *cancellable,
14772 GAsyncReadyCallback callback,
14773 gpointer user_data)
14774{
14775 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14776 "setPowerState",
14777 g_variant_new ("(i)",
14778 arg_state),
14779 G_DBUS_CALL_FLAGS_NONE,
14780 -1,
14781 cancellable,
14782 callback,
14783 user_data);
14784}
14785
14786/**
14787 * control_power_call_set_power_state_finish:
14788 * @proxy: A #ControlPowerProxy.
14789 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
14790 * @error: Return location for error or %NULL.
14791 *
14792 * Finishes an operation started with control_power_call_set_power_state().
14793 *
14794 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14795 */
14796gboolean
14797control_power_call_set_power_state_finish (
14798 ControlPower *proxy,
14799 GAsyncResult *res,
14800 GError **error)
14801{
14802 GVariant *_ret;
14803 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14804 if (_ret == NULL)
14805 goto _out;
14806 g_variant_get (_ret,
14807 "()");
14808 g_variant_unref (_ret);
14809_out:
14810 return _ret != NULL;
14811}
14812
14813/**
14814 * control_power_call_set_power_state_sync:
14815 * @proxy: A #ControlPowerProxy.
14816 * @arg_state: Argument to pass with the method invocation.
14817 * @cancellable: (allow-none): A #GCancellable or %NULL.
14818 * @error: Return location for error or %NULL.
14819 *
14820 * 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.
14821 *
14822 * See control_power_call_set_power_state() for the asynchronous version of this method.
14823 *
14824 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14825 */
14826gboolean
14827control_power_call_set_power_state_sync (
14828 ControlPower *proxy,
14829 gint arg_state,
14830 GCancellable *cancellable,
14831 GError **error)
14832{
14833 GVariant *_ret;
14834 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14835 "setPowerState",
14836 g_variant_new ("(i)",
14837 arg_state),
14838 G_DBUS_CALL_FLAGS_NONE,
14839 -1,
14840 cancellable,
14841 error);
14842 if (_ret == NULL)
14843 goto _out;
14844 g_variant_get (_ret,
14845 "()");
14846 g_variant_unref (_ret);
14847_out:
14848 return _ret != NULL;
14849}
14850
14851/**
14852 * control_power_call_get_power_state:
14853 * @proxy: A #ControlPowerProxy.
14854 * @cancellable: (allow-none): A #GCancellable or %NULL.
14855 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14856 * @user_data: User data to pass to @callback.
14857 *
14858 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
14859 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14860 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
14861 *
14862 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
14863 */
14864void
14865control_power_call_get_power_state (
14866 ControlPower *proxy,
14867 GCancellable *cancellable,
14868 GAsyncReadyCallback callback,
14869 gpointer user_data)
14870{
14871 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14872 "getPowerState",
14873 g_variant_new ("()"),
14874 G_DBUS_CALL_FLAGS_NONE,
14875 -1,
14876 cancellable,
14877 callback,
14878 user_data);
14879}
14880
14881/**
14882 * control_power_call_get_power_state_finish:
14883 * @proxy: A #ControlPowerProxy.
14884 * @out_state: (out): Return location for return parameter or %NULL to ignore.
14885 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
14886 * @error: Return location for error or %NULL.
14887 *
14888 * Finishes an operation started with control_power_call_get_power_state().
14889 *
14890 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14891 */
14892gboolean
14893control_power_call_get_power_state_finish (
14894 ControlPower *proxy,
14895 gint *out_state,
14896 GAsyncResult *res,
14897 GError **error)
14898{
14899 GVariant *_ret;
14900 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14901 if (_ret == NULL)
14902 goto _out;
14903 g_variant_get (_ret,
14904 "(i)",
14905 out_state);
14906 g_variant_unref (_ret);
14907_out:
14908 return _ret != NULL;
14909}
14910
14911/**
14912 * control_power_call_get_power_state_sync:
14913 * @proxy: A #ControlPowerProxy.
14914 * @out_state: (out): Return location for return parameter or %NULL to ignore.
14915 * @cancellable: (allow-none): A #GCancellable or %NULL.
14916 * @error: Return location for error or %NULL.
14917 *
14918 * 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.
14919 *
14920 * See control_power_call_get_power_state() for the asynchronous version of this method.
14921 *
14922 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14923 */
14924gboolean
14925control_power_call_get_power_state_sync (
14926 ControlPower *proxy,
14927 gint *out_state,
14928 GCancellable *cancellable,
14929 GError **error)
14930{
14931 GVariant *_ret;
14932 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14933 "getPowerState",
14934 g_variant_new ("()"),
14935 G_DBUS_CALL_FLAGS_NONE,
14936 -1,
14937 cancellable,
14938 error);
14939 if (_ret == NULL)
14940 goto _out;
14941 g_variant_get (_ret,
14942 "(i)",
14943 out_state);
14944 g_variant_unref (_ret);
14945_out:
14946 return _ret != NULL;
14947}
14948
14949/**
14950 * control_power_complete_set_power_state:
14951 * @object: A #ControlPower.
14952 * @invocation: (transfer full): A #GDBusMethodInvocation.
14953 *
14954 * 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.
14955 *
14956 * This method will free @invocation, you cannot use it afterwards.
14957 */
14958void
14959control_power_complete_set_power_state (
14960 ControlPower *object,
14961 GDBusMethodInvocation *invocation)
14962{
14963 g_dbus_method_invocation_return_value (invocation,
14964 g_variant_new ("()"));
14965}
14966
14967/**
14968 * control_power_complete_get_power_state:
14969 * @object: A #ControlPower.
14970 * @invocation: (transfer full): A #GDBusMethodInvocation.
14971 * @state: Parameter to return.
14972 *
14973 * 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.
14974 *
14975 * This method will free @invocation, you cannot use it afterwards.
14976 */
14977void
14978control_power_complete_get_power_state (
14979 ControlPower *object,
14980 GDBusMethodInvocation *invocation,
14981 gint state)
14982{
14983 g_dbus_method_invocation_return_value (invocation,
14984 g_variant_new ("(i)",
14985 state));
14986}
14987
14988/* ------------------------------------------------------------------------ */
14989
14990/**
14991 * ControlPowerProxy:
14992 *
14993 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
14994 */
14995
14996/**
14997 * ControlPowerProxyClass:
14998 * @parent_class: The parent class.
14999 *
15000 * Class structure for #ControlPowerProxy.
15001 */
15002
15003struct _ControlPowerProxyPrivate
15004{
15005 GData *qdata;
15006};
15007
15008static void control_power_proxy_iface_init (ControlPowerIface *iface);
15009
15010#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15011G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15012 G_ADD_PRIVATE (ControlPowerProxy)
15013 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15014
15015#else
15016G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15017 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15018
15019#endif
15020static void
15021control_power_proxy_finalize (GObject *object)
15022{
15023 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15024 g_datalist_clear (&proxy->priv->qdata);
15025 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
15026}
15027
15028static void
15029control_power_proxy_get_property (GObject *object,
15030 guint prop_id,
15031 GValue *value,
15032 GParamSpec *pspec G_GNUC_UNUSED)
15033{
15034 const _ExtendedGDBusPropertyInfo *info;
15035 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015036 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015037 info = _control_power_property_info_pointers[prop_id - 1];
15038 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
15039 if (info->use_gvariant)
15040 {
15041 g_value_set_variant (value, variant);
15042 }
15043 else
15044 {
15045 if (variant != NULL)
15046 g_dbus_gvariant_to_gvalue (variant, value);
15047 }
15048 if (variant != NULL)
15049 g_variant_unref (variant);
15050}
15051
15052static void
15053control_power_proxy_set_property_cb (GDBusProxy *proxy,
15054 GAsyncResult *res,
15055 gpointer user_data)
15056{
15057 const _ExtendedGDBusPropertyInfo *info = user_data;
15058 GError *error;
15059 GVariant *_ret;
15060 error = NULL;
15061 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
15062 if (!_ret)
15063 {
15064 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
15065 info->parent_struct.name,
15066 error->message, g_quark_to_string (error->domain), error->code);
15067 g_error_free (error);
15068 }
15069 else
15070 {
15071 g_variant_unref (_ret);
15072 }
15073}
15074
15075static void
15076control_power_proxy_set_property (GObject *object,
15077 guint prop_id,
15078 const GValue *value,
15079 GParamSpec *pspec G_GNUC_UNUSED)
15080{
15081 const _ExtendedGDBusPropertyInfo *info;
15082 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015083 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015084 info = _control_power_property_info_pointers[prop_id - 1];
15085 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
15086 g_dbus_proxy_call (G_DBUS_PROXY (object),
15087 "org.freedesktop.DBus.Properties.Set",
15088 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
15089 G_DBUS_CALL_FLAGS_NONE,
15090 -1,
15091 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
15092 g_variant_unref (variant);
15093}
15094
15095static void
15096control_power_proxy_g_signal (GDBusProxy *proxy,
15097 const gchar *sender_name G_GNUC_UNUSED,
15098 const gchar *signal_name,
15099 GVariant *parameters)
15100{
15101 _ExtendedGDBusSignalInfo *info;
15102 GVariantIter iter;
15103 GVariant *child;
15104 GValue *paramv;
15105 guint num_params;
15106 guint n;
15107 guint signal_id;
15108 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
15109 if (info == NULL)
15110 return;
15111 num_params = g_variant_n_children (parameters);
15112 paramv = g_new0 (GValue, num_params + 1);
15113 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
15114 g_value_set_object (&paramv[0], proxy);
15115 g_variant_iter_init (&iter, parameters);
15116 n = 1;
15117 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15118 {
15119 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15120 if (arg_info->use_gvariant)
15121 {
15122 g_value_init (&paramv[n], G_TYPE_VARIANT);
15123 g_value_set_variant (&paramv[n], child);
15124 n++;
15125 }
15126 else
15127 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15128 g_variant_unref (child);
15129 }
15130 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15131 g_signal_emitv (paramv, signal_id, 0, NULL);
15132 for (n = 0; n < num_params + 1; n++)
15133 g_value_unset (&paramv[n]);
15134 g_free (paramv);
15135}
15136
15137static void
15138control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
15139 GVariant *changed_properties,
15140 const gchar *const *invalidated_properties)
15141{
15142 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
15143 guint n;
15144 const gchar *key;
15145 GVariantIter *iter;
15146 _ExtendedGDBusPropertyInfo *info;
15147 g_variant_get (changed_properties, "a{sv}", &iter);
15148 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15149 {
15150 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
15151 g_datalist_remove_data (&proxy->priv->qdata, key);
15152 if (info != NULL)
15153 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15154 }
15155 g_variant_iter_free (iter);
15156 for (n = 0; invalidated_properties[n] != NULL; n++)
15157 {
15158 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
15159 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15160 if (info != NULL)
15161 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15162 }
15163}
15164
15165static gint
15166control_power_proxy_get_pgood (ControlPower *object)
15167{
15168 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15169 GVariant *variant;
15170 gint value = 0;
15171 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
15172 if (variant != NULL)
15173 {
15174 value = g_variant_get_int32 (variant);
15175 g_variant_unref (variant);
15176 }
15177 return value;
15178}
15179
15180static gint
15181control_power_proxy_get_state (ControlPower *object)
15182{
15183 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15184 GVariant *variant;
15185 gint value = 0;
15186 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
15187 if (variant != NULL)
15188 {
15189 value = g_variant_get_int32 (variant);
15190 g_variant_unref (variant);
15191 }
15192 return value;
15193}
15194
Norman James32e74e22015-09-15 21:28:06 -050015195static gint
15196control_power_proxy_get_pgood_timeout (ControlPower *object)
15197{
15198 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15199 GVariant *variant;
15200 gint value = 0;
15201 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
15202 if (variant != NULL)
15203 {
15204 value = g_variant_get_int32 (variant);
15205 g_variant_unref (variant);
15206 }
15207 return value;
15208}
15209
Norman James362a80f2015-09-14 14:04:39 -050015210static void
15211control_power_proxy_init (ControlPowerProxy *proxy)
15212{
15213#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15214 proxy->priv = control_power_proxy_get_instance_private (proxy);
15215#else
15216 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
15217#endif
15218
15219 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
15220}
15221
15222static void
15223control_power_proxy_class_init (ControlPowerProxyClass *klass)
15224{
15225 GObjectClass *gobject_class;
15226 GDBusProxyClass *proxy_class;
15227
15228 gobject_class = G_OBJECT_CLASS (klass);
15229 gobject_class->finalize = control_power_proxy_finalize;
15230 gobject_class->get_property = control_power_proxy_get_property;
15231 gobject_class->set_property = control_power_proxy_set_property;
15232
15233 proxy_class = G_DBUS_PROXY_CLASS (klass);
15234 proxy_class->g_signal = control_power_proxy_g_signal;
15235 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
15236
15237 control_power_override_properties (gobject_class, 1);
15238
15239#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15240 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
15241#endif
15242}
15243
15244static void
15245control_power_proxy_iface_init (ControlPowerIface *iface)
15246{
15247 iface->get_pgood = control_power_proxy_get_pgood;
15248 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050015249 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050015250}
15251
15252/**
15253 * control_power_proxy_new:
15254 * @connection: A #GDBusConnection.
15255 * @flags: Flags from the #GDBusProxyFlags enumeration.
15256 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15257 * @object_path: An object path.
15258 * @cancellable: (allow-none): A #GCancellable or %NULL.
15259 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15260 * @user_data: User data to pass to @callback.
15261 *
15262 * 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.
15263 *
15264 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15265 * You can then call control_power_proxy_new_finish() to get the result of the operation.
15266 *
15267 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
15268 */
15269void
15270control_power_proxy_new (
15271 GDBusConnection *connection,
15272 GDBusProxyFlags flags,
15273 const gchar *name,
15274 const gchar *object_path,
15275 GCancellable *cancellable,
15276 GAsyncReadyCallback callback,
15277 gpointer user_data)
15278{
15279 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);
15280}
15281
15282/**
15283 * control_power_proxy_new_finish:
15284 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
15285 * @error: Return location for error or %NULL
15286 *
15287 * Finishes an operation started with control_power_proxy_new().
15288 *
15289 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15290 */
15291ControlPower *
15292control_power_proxy_new_finish (
15293 GAsyncResult *res,
15294 GError **error)
15295{
15296 GObject *ret;
15297 GObject *source_object;
15298 source_object = g_async_result_get_source_object (res);
15299 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15300 g_object_unref (source_object);
15301 if (ret != NULL)
15302 return CONTROL_POWER (ret);
15303 else
15304 return NULL;
15305}
15306
15307/**
15308 * control_power_proxy_new_sync:
15309 * @connection: A #GDBusConnection.
15310 * @flags: Flags from the #GDBusProxyFlags enumeration.
15311 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15312 * @object_path: An object path.
15313 * @cancellable: (allow-none): A #GCancellable or %NULL.
15314 * @error: Return location for error or %NULL
15315 *
15316 * 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.
15317 *
15318 * The calling thread is blocked until a reply is received.
15319 *
15320 * See control_power_proxy_new() for the asynchronous version of this constructor.
15321 *
15322 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15323 */
15324ControlPower *
15325control_power_proxy_new_sync (
15326 GDBusConnection *connection,
15327 GDBusProxyFlags flags,
15328 const gchar *name,
15329 const gchar *object_path,
15330 GCancellable *cancellable,
15331 GError **error)
15332{
15333 GInitable *ret;
15334 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);
15335 if (ret != NULL)
15336 return CONTROL_POWER (ret);
15337 else
15338 return NULL;
15339}
15340
15341
15342/**
15343 * control_power_proxy_new_for_bus:
15344 * @bus_type: A #GBusType.
15345 * @flags: Flags from the #GDBusProxyFlags enumeration.
15346 * @name: A bus name (well-known or unique).
15347 * @object_path: An object path.
15348 * @cancellable: (allow-none): A #GCancellable or %NULL.
15349 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15350 * @user_data: User data to pass to @callback.
15351 *
15352 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15353 *
15354 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15355 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
15356 *
15357 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15358 */
15359void
15360control_power_proxy_new_for_bus (
15361 GBusType bus_type,
15362 GDBusProxyFlags flags,
15363 const gchar *name,
15364 const gchar *object_path,
15365 GCancellable *cancellable,
15366 GAsyncReadyCallback callback,
15367 gpointer user_data)
15368{
15369 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);
15370}
15371
15372/**
15373 * control_power_proxy_new_for_bus_finish:
15374 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
15375 * @error: Return location for error or %NULL
15376 *
15377 * Finishes an operation started with control_power_proxy_new_for_bus().
15378 *
15379 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15380 */
15381ControlPower *
15382control_power_proxy_new_for_bus_finish (
15383 GAsyncResult *res,
15384 GError **error)
15385{
15386 GObject *ret;
15387 GObject *source_object;
15388 source_object = g_async_result_get_source_object (res);
15389 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15390 g_object_unref (source_object);
15391 if (ret != NULL)
15392 return CONTROL_POWER (ret);
15393 else
15394 return NULL;
15395}
15396
15397/**
15398 * control_power_proxy_new_for_bus_sync:
15399 * @bus_type: A #GBusType.
15400 * @flags: Flags from the #GDBusProxyFlags enumeration.
15401 * @name: A bus name (well-known or unique).
15402 * @object_path: An object path.
15403 * @cancellable: (allow-none): A #GCancellable or %NULL.
15404 * @error: Return location for error or %NULL
15405 *
15406 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15407 *
15408 * The calling thread is blocked until a reply is received.
15409 *
15410 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
15411 *
15412 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15413 */
15414ControlPower *
15415control_power_proxy_new_for_bus_sync (
15416 GBusType bus_type,
15417 GDBusProxyFlags flags,
15418 const gchar *name,
15419 const gchar *object_path,
15420 GCancellable *cancellable,
15421 GError **error)
15422{
15423 GInitable *ret;
15424 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);
15425 if (ret != NULL)
15426 return CONTROL_POWER (ret);
15427 else
15428 return NULL;
15429}
15430
15431
15432/* ------------------------------------------------------------------------ */
15433
15434/**
15435 * ControlPowerSkeleton:
15436 *
15437 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
15438 */
15439
15440/**
15441 * ControlPowerSkeletonClass:
15442 * @parent_class: The parent class.
15443 *
15444 * Class structure for #ControlPowerSkeleton.
15445 */
15446
15447struct _ControlPowerSkeletonPrivate
15448{
15449 GValue *properties;
15450 GList *changed_properties;
15451 GSource *changed_properties_idle_source;
15452 GMainContext *context;
15453 GMutex lock;
15454};
15455
15456static void
15457_control_power_skeleton_handle_method_call (
15458 GDBusConnection *connection G_GNUC_UNUSED,
15459 const gchar *sender G_GNUC_UNUSED,
15460 const gchar *object_path G_GNUC_UNUSED,
15461 const gchar *interface_name,
15462 const gchar *method_name,
15463 GVariant *parameters,
15464 GDBusMethodInvocation *invocation,
15465 gpointer user_data)
15466{
15467 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15468 _ExtendedGDBusMethodInfo *info;
15469 GVariantIter iter;
15470 GVariant *child;
15471 GValue *paramv;
15472 guint num_params;
15473 guint num_extra;
15474 guint n;
15475 guint signal_id;
15476 GValue return_value = G_VALUE_INIT;
15477 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15478 g_assert (info != NULL);
15479 num_params = g_variant_n_children (parameters);
15480 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15481 n = 0;
15482 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
15483 g_value_set_object (&paramv[n++], skeleton);
15484 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15485 g_value_set_object (&paramv[n++], invocation);
15486 if (info->pass_fdlist)
15487 {
15488#ifdef G_OS_UNIX
15489 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15490 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15491#else
15492 g_assert_not_reached ();
15493#endif
15494 }
15495 g_variant_iter_init (&iter, parameters);
15496 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15497 {
15498 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15499 if (arg_info->use_gvariant)
15500 {
15501 g_value_init (&paramv[n], G_TYPE_VARIANT);
15502 g_value_set_variant (&paramv[n], child);
15503 n++;
15504 }
15505 else
15506 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15507 g_variant_unref (child);
15508 }
15509 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15510 g_value_init (&return_value, G_TYPE_BOOLEAN);
15511 g_signal_emitv (paramv, signal_id, 0, &return_value);
15512 if (!g_value_get_boolean (&return_value))
15513 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);
15514 g_value_unset (&return_value);
15515 for (n = 0; n < num_params + num_extra; n++)
15516 g_value_unset (&paramv[n]);
15517 g_free (paramv);
15518}
15519
15520static GVariant *
15521_control_power_skeleton_handle_get_property (
15522 GDBusConnection *connection G_GNUC_UNUSED,
15523 const gchar *sender G_GNUC_UNUSED,
15524 const gchar *object_path G_GNUC_UNUSED,
15525 const gchar *interface_name G_GNUC_UNUSED,
15526 const gchar *property_name,
15527 GError **error,
15528 gpointer user_data)
15529{
15530 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15531 GValue value = G_VALUE_INIT;
15532 GParamSpec *pspec;
15533 _ExtendedGDBusPropertyInfo *info;
15534 GVariant *ret;
15535 ret = NULL;
15536 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15537 g_assert (info != NULL);
15538 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15539 if (pspec == NULL)
15540 {
15541 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15542 }
15543 else
15544 {
15545 g_value_init (&value, pspec->value_type);
15546 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15547 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15548 g_value_unset (&value);
15549 }
15550 return ret;
15551}
15552
15553static gboolean
15554_control_power_skeleton_handle_set_property (
15555 GDBusConnection *connection G_GNUC_UNUSED,
15556 const gchar *sender G_GNUC_UNUSED,
15557 const gchar *object_path G_GNUC_UNUSED,
15558 const gchar *interface_name G_GNUC_UNUSED,
15559 const gchar *property_name,
15560 GVariant *variant,
15561 GError **error,
15562 gpointer user_data)
15563{
15564 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15565 GValue value = G_VALUE_INIT;
15566 GParamSpec *pspec;
15567 _ExtendedGDBusPropertyInfo *info;
15568 gboolean ret;
15569 ret = FALSE;
15570 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15571 g_assert (info != NULL);
15572 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15573 if (pspec == NULL)
15574 {
15575 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15576 }
15577 else
15578 {
15579 if (info->use_gvariant)
15580 g_value_set_variant (&value, variant);
15581 else
15582 g_dbus_gvariant_to_gvalue (variant, &value);
15583 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15584 g_value_unset (&value);
15585 ret = TRUE;
15586 }
15587 return ret;
15588}
15589
15590static const GDBusInterfaceVTable _control_power_skeleton_vtable =
15591{
15592 _control_power_skeleton_handle_method_call,
15593 _control_power_skeleton_handle_get_property,
15594 _control_power_skeleton_handle_set_property,
15595 {NULL}
15596};
15597
15598static GDBusInterfaceInfo *
15599control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15600{
15601 return control_power_interface_info ();
15602}
15603
15604static GDBusInterfaceVTable *
15605control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15606{
15607 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
15608}
15609
15610static GVariant *
15611control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15612{
15613 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15614
15615 GVariantBuilder builder;
15616 guint n;
15617 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15618 if (_control_power_interface_info.parent_struct.properties == NULL)
15619 goto out;
15620 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
15621 {
15622 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
15623 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15624 {
15625 GVariant *value;
15626 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);
15627 if (value != NULL)
15628 {
15629 g_variant_take_ref (value);
15630 g_variant_builder_add (&builder, "{sv}", info->name, value);
15631 g_variant_unref (value);
15632 }
15633 }
15634 }
15635out:
15636 return g_variant_builder_end (&builder);
15637}
15638
15639static gboolean _control_power_emit_changed (gpointer user_data);
15640
15641static void
15642control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15643{
15644 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15645 gboolean emit_changed = FALSE;
15646
15647 g_mutex_lock (&skeleton->priv->lock);
15648 if (skeleton->priv->changed_properties_idle_source != NULL)
15649 {
15650 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15651 skeleton->priv->changed_properties_idle_source = NULL;
15652 emit_changed = TRUE;
15653 }
15654 g_mutex_unlock (&skeleton->priv->lock);
15655
15656 if (emit_changed)
15657 _control_power_emit_changed (skeleton);
15658}
15659
15660static void
15661_control_power_on_signal_power_good (
15662 ControlPower *object)
15663{
15664 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15665
15666 GList *connections, *l;
15667 GVariant *signal_variant;
15668 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15669
15670 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15671 for (l = connections; l != NULL; l = l->next)
15672 {
15673 GDBusConnection *connection = l->data;
15674 g_dbus_connection_emit_signal (connection,
15675 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
15676 signal_variant, NULL);
15677 }
15678 g_variant_unref (signal_variant);
15679 g_list_free_full (connections, g_object_unref);
15680}
15681
15682static void
15683_control_power_on_signal_power_lost (
15684 ControlPower *object)
15685{
15686 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15687
15688 GList *connections, *l;
15689 GVariant *signal_variant;
15690 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15691
15692 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15693 for (l = connections; l != NULL; l = l->next)
15694 {
15695 GDBusConnection *connection = l->data;
15696 g_dbus_connection_emit_signal (connection,
15697 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
15698 signal_variant, NULL);
15699 }
15700 g_variant_unref (signal_variant);
15701 g_list_free_full (connections, g_object_unref);
15702}
15703
15704static void control_power_skeleton_iface_init (ControlPowerIface *iface);
15705#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15706G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15707 G_ADD_PRIVATE (ControlPowerSkeleton)
15708 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15709
15710#else
15711G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15712 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15713
15714#endif
15715static void
15716control_power_skeleton_finalize (GObject *object)
15717{
15718 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15719 guint n;
Norman James32e74e22015-09-15 21:28:06 -050015720 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050015721 g_value_unset (&skeleton->priv->properties[n]);
15722 g_free (skeleton->priv->properties);
15723 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15724 if (skeleton->priv->changed_properties_idle_source != NULL)
15725 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15726 g_main_context_unref (skeleton->priv->context);
15727 g_mutex_clear (&skeleton->priv->lock);
15728 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
15729}
15730
15731static void
15732control_power_skeleton_get_property (GObject *object,
15733 guint prop_id,
15734 GValue *value,
15735 GParamSpec *pspec G_GNUC_UNUSED)
15736{
15737 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050015738 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015739 g_mutex_lock (&skeleton->priv->lock);
15740 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
15741 g_mutex_unlock (&skeleton->priv->lock);
15742}
15743
15744static gboolean
15745_control_power_emit_changed (gpointer user_data)
15746{
15747 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15748 GList *l;
15749 GVariantBuilder builder;
15750 GVariantBuilder invalidated_builder;
15751 guint num_changes;
15752
15753 g_mutex_lock (&skeleton->priv->lock);
15754 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15755 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
15756 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
15757 {
15758 ChangedProperty *cp = l->data;
15759 GVariant *variant;
15760 const GValue *cur_value;
15761
15762 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
15763 if (!_g_value_equal (cur_value, &cp->orig_value))
15764 {
15765 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
15766 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
15767 g_variant_unref (variant);
15768 num_changes++;
15769 }
15770 }
15771 if (num_changes > 0)
15772 {
15773 GList *connections, *ll;
15774 GVariant *signal_variant;
15775 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
15776 &builder, &invalidated_builder));
15777 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15778 for (ll = connections; ll != NULL; ll = ll->next)
15779 {
15780 GDBusConnection *connection = ll->data;
15781
15782 g_dbus_connection_emit_signal (connection,
15783 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
15784 "org.freedesktop.DBus.Properties",
15785 "PropertiesChanged",
15786 signal_variant,
15787 NULL);
15788 }
15789 g_variant_unref (signal_variant);
15790 g_list_free_full (connections, g_object_unref);
15791 }
15792 else
15793 {
15794 g_variant_builder_clear (&builder);
15795 g_variant_builder_clear (&invalidated_builder);
15796 }
15797 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15798 skeleton->priv->changed_properties = NULL;
15799 skeleton->priv->changed_properties_idle_source = NULL;
15800 g_mutex_unlock (&skeleton->priv->lock);
15801 return FALSE;
15802}
15803
15804static void
15805_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
15806{
15807 ChangedProperty *cp;
15808 GList *l;
15809 cp = NULL;
15810 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
15811 {
15812 ChangedProperty *i_cp = l->data;
15813 if (i_cp->info == info)
15814 {
15815 cp = i_cp;
15816 break;
15817 }
15818 }
15819 if (cp == NULL)
15820 {
15821 cp = g_new0 (ChangedProperty, 1);
15822 cp->prop_id = prop_id;
15823 cp->info = info;
15824 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
15825 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
15826 g_value_copy (orig_value, &cp->orig_value);
15827 }
15828}
15829
15830static void
15831control_power_skeleton_notify (GObject *object,
15832 GParamSpec *pspec G_GNUC_UNUSED)
15833{
15834 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15835 g_mutex_lock (&skeleton->priv->lock);
15836 if (skeleton->priv->changed_properties != NULL &&
15837 skeleton->priv->changed_properties_idle_source == NULL)
15838 {
15839 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
15840 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
15841 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
15842 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
15843 g_source_unref (skeleton->priv->changed_properties_idle_source);
15844 }
15845 g_mutex_unlock (&skeleton->priv->lock);
15846}
15847
15848static void
15849control_power_skeleton_set_property (GObject *object,
15850 guint prop_id,
15851 const GValue *value,
15852 GParamSpec *pspec)
15853{
15854 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050015855 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015856 g_mutex_lock (&skeleton->priv->lock);
15857 g_object_freeze_notify (object);
15858 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
15859 {
15860 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
15861 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
15862 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
15863 g_object_notify_by_pspec (object, pspec);
15864 }
15865 g_mutex_unlock (&skeleton->priv->lock);
15866 g_object_thaw_notify (object);
15867}
15868
15869static void
15870control_power_skeleton_init (ControlPowerSkeleton *skeleton)
15871{
15872#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15873 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
15874#else
15875 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
15876#endif
15877
15878 g_mutex_init (&skeleton->priv->lock);
15879 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050015880 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050015881 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
15882 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050015883 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050015884}
15885
15886static gint
15887control_power_skeleton_get_pgood (ControlPower *object)
15888{
15889 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15890 gint value;
15891 g_mutex_lock (&skeleton->priv->lock);
15892 value = g_value_get_int (&(skeleton->priv->properties[0]));
15893 g_mutex_unlock (&skeleton->priv->lock);
15894 return value;
15895}
15896
15897static gint
15898control_power_skeleton_get_state (ControlPower *object)
15899{
15900 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15901 gint value;
15902 g_mutex_lock (&skeleton->priv->lock);
15903 value = g_value_get_int (&(skeleton->priv->properties[1]));
15904 g_mutex_unlock (&skeleton->priv->lock);
15905 return value;
15906}
15907
Norman James32e74e22015-09-15 21:28:06 -050015908static gint
15909control_power_skeleton_get_pgood_timeout (ControlPower *object)
15910{
15911 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15912 gint value;
15913 g_mutex_lock (&skeleton->priv->lock);
15914 value = g_value_get_int (&(skeleton->priv->properties[2]));
15915 g_mutex_unlock (&skeleton->priv->lock);
15916 return value;
15917}
15918
Norman James362a80f2015-09-14 14:04:39 -050015919static void
15920control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
15921{
15922 GObjectClass *gobject_class;
15923 GDBusInterfaceSkeletonClass *skeleton_class;
15924
15925 gobject_class = G_OBJECT_CLASS (klass);
15926 gobject_class->finalize = control_power_skeleton_finalize;
15927 gobject_class->get_property = control_power_skeleton_get_property;
15928 gobject_class->set_property = control_power_skeleton_set_property;
15929 gobject_class->notify = control_power_skeleton_notify;
15930
15931
15932 control_power_override_properties (gobject_class, 1);
15933
15934 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15935 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
15936 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
15937 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
15938 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
15939
15940#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15941 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
15942#endif
15943}
15944
15945static void
15946control_power_skeleton_iface_init (ControlPowerIface *iface)
15947{
15948 iface->power_good = _control_power_on_signal_power_good;
15949 iface->power_lost = _control_power_on_signal_power_lost;
15950 iface->get_pgood = control_power_skeleton_get_pgood;
15951 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050015952 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050015953}
15954
15955/**
15956 * control_power_skeleton_new:
15957 *
15958 * 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>.
15959 *
15960 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
15961 */
15962ControlPower *
15963control_power_skeleton_new (void)
15964{
15965 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
15966}
15967
15968/* ------------------------------------------------------------------------
15969 * Code for interface org.openbmc.Watchdog
15970 * ------------------------------------------------------------------------
15971 */
15972
15973/**
15974 * SECTION:Watchdog
15975 * @title: Watchdog
15976 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
15977 *
15978 * 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.
15979 */
15980
15981/* ---- Introspection data for org.openbmc.Watchdog ---- */
15982
15983static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
15984{
15985 {
15986 -1,
15987 (gchar *) "start",
15988 NULL,
15989 NULL,
15990 NULL
15991 },
15992 "handle-start",
15993 FALSE
15994};
15995
15996static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
15997{
15998 {
15999 -1,
16000 (gchar *) "poke",
16001 NULL,
16002 NULL,
16003 NULL
16004 },
16005 "handle-poke",
16006 FALSE
16007};
16008
16009static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
16010{
16011 {
16012 -1,
16013 (gchar *) "stop",
16014 NULL,
16015 NULL,
16016 NULL
16017 },
16018 "handle-stop",
16019 FALSE
16020};
16021
16022static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
16023{
16024 &_watchdog_method_info_start,
16025 &_watchdog_method_info_poke,
16026 &_watchdog_method_info_stop,
16027 NULL
16028};
16029
16030static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
16031{
16032 {
16033 -1,
16034 (gchar *) "WatchdogError",
16035 NULL,
16036 NULL
16037 },
16038 "watchdog-error"
16039};
16040
16041static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
16042{
16043 &_watchdog_signal_info_watchdog_error,
16044 NULL
16045};
16046
16047static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
16048{
16049 {
16050 -1,
16051 (gchar *) "watchdog",
16052 (gchar *) "i",
16053 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16054 NULL
16055 },
16056 "watchdog",
16057 FALSE
16058};
16059
16060static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
16061{
16062 {
16063 -1,
16064 (gchar *) "poll_interval",
16065 (gchar *) "i",
16066 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16067 NULL
16068 },
16069 "poll-interval",
16070 FALSE
16071};
16072
16073static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
16074{
16075 &_watchdog_property_info_watchdog,
16076 &_watchdog_property_info_poll_interval,
16077 NULL
16078};
16079
16080static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
16081{
16082 {
16083 -1,
16084 (gchar *) "org.openbmc.Watchdog",
16085 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
16086 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
16087 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
16088 NULL
16089 },
16090 "watchdog",
16091};
16092
16093
16094/**
16095 * watchdog_interface_info:
16096 *
16097 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
16098 *
16099 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16100 */
16101GDBusInterfaceInfo *
16102watchdog_interface_info (void)
16103{
16104 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
16105}
16106
16107/**
16108 * watchdog_override_properties:
16109 * @klass: The class structure for a #GObject<!-- -->-derived class.
16110 * @property_id_begin: The property id to assign to the first overridden property.
16111 *
16112 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
16113 * The properties are overridden in the order they are defined.
16114 *
16115 * Returns: The last property id.
16116 */
16117guint
16118watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
16119{
16120 g_object_class_override_property (klass, property_id_begin++, "watchdog");
16121 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
16122 return property_id_begin - 1;
16123}
16124
16125
16126
16127/**
16128 * Watchdog:
16129 *
16130 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16131 */
16132
16133/**
16134 * WatchdogIface:
16135 * @parent_iface: The parent interface.
16136 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
16137 * @handle_start: Handler for the #Watchdog::handle-start signal.
16138 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
16139 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
16140 * @get_watchdog: Getter for the #Watchdog:watchdog property.
16141 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
16142 *
16143 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16144 */
16145
16146typedef WatchdogIface WatchdogInterface;
16147G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
16148
16149static void
16150watchdog_default_init (WatchdogIface *iface)
16151{
16152 /* GObject signals for incoming D-Bus method calls: */
16153 /**
16154 * Watchdog::handle-start:
16155 * @object: A #Watchdog.
16156 * @invocation: A #GDBusMethodInvocation.
16157 *
16158 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
16159 *
16160 * 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.
16161 *
16162 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16163 */
16164 g_signal_new ("handle-start",
16165 G_TYPE_FROM_INTERFACE (iface),
16166 G_SIGNAL_RUN_LAST,
16167 G_STRUCT_OFFSET (WatchdogIface, handle_start),
16168 g_signal_accumulator_true_handled,
16169 NULL,
16170 g_cclosure_marshal_generic,
16171 G_TYPE_BOOLEAN,
16172 1,
16173 G_TYPE_DBUS_METHOD_INVOCATION);
16174
16175 /**
16176 * Watchdog::handle-poke:
16177 * @object: A #Watchdog.
16178 * @invocation: A #GDBusMethodInvocation.
16179 *
16180 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
16181 *
16182 * 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.
16183 *
16184 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16185 */
16186 g_signal_new ("handle-poke",
16187 G_TYPE_FROM_INTERFACE (iface),
16188 G_SIGNAL_RUN_LAST,
16189 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
16190 g_signal_accumulator_true_handled,
16191 NULL,
16192 g_cclosure_marshal_generic,
16193 G_TYPE_BOOLEAN,
16194 1,
16195 G_TYPE_DBUS_METHOD_INVOCATION);
16196
16197 /**
16198 * Watchdog::handle-stop:
16199 * @object: A #Watchdog.
16200 * @invocation: A #GDBusMethodInvocation.
16201 *
16202 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
16203 *
16204 * 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.
16205 *
16206 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16207 */
16208 g_signal_new ("handle-stop",
16209 G_TYPE_FROM_INTERFACE (iface),
16210 G_SIGNAL_RUN_LAST,
16211 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
16212 g_signal_accumulator_true_handled,
16213 NULL,
16214 g_cclosure_marshal_generic,
16215 G_TYPE_BOOLEAN,
16216 1,
16217 G_TYPE_DBUS_METHOD_INVOCATION);
16218
16219 /* GObject signals for received D-Bus signals: */
16220 /**
16221 * Watchdog::watchdog-error:
16222 * @object: A #Watchdog.
16223 *
16224 * 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.
16225 *
16226 * 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.
16227 */
16228 g_signal_new ("watchdog-error",
16229 G_TYPE_FROM_INTERFACE (iface),
16230 G_SIGNAL_RUN_LAST,
16231 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
16232 NULL,
16233 NULL,
16234 g_cclosure_marshal_generic,
16235 G_TYPE_NONE,
16236 0);
16237
16238 /* GObject properties for D-Bus properties: */
16239 /**
16240 * Watchdog:watchdog:
16241 *
16242 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
16243 *
16244 * 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.
16245 */
16246 g_object_interface_install_property (iface,
16247 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16248 /**
16249 * Watchdog:poll-interval:
16250 *
16251 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
16252 *
16253 * 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.
16254 */
16255 g_object_interface_install_property (iface,
16256 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16257}
16258
16259/**
16260 * watchdog_get_watchdog: (skip)
16261 * @object: A #Watchdog.
16262 *
16263 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
16264 *
16265 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16266 *
16267 * Returns: The property value.
16268 */
16269gint
16270watchdog_get_watchdog (Watchdog *object)
16271{
16272 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
16273}
16274
16275/**
16276 * watchdog_set_watchdog: (skip)
16277 * @object: A #Watchdog.
16278 * @value: The value to set.
16279 *
16280 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
16281 *
16282 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16283 */
16284void
16285watchdog_set_watchdog (Watchdog *object, gint value)
16286{
16287 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
16288}
16289
16290/**
16291 * watchdog_get_poll_interval: (skip)
16292 * @object: A #Watchdog.
16293 *
16294 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
16295 *
16296 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16297 *
16298 * Returns: The property value.
16299 */
16300gint
16301watchdog_get_poll_interval (Watchdog *object)
16302{
16303 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
16304}
16305
16306/**
16307 * watchdog_set_poll_interval: (skip)
16308 * @object: A #Watchdog.
16309 * @value: The value to set.
16310 *
16311 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
16312 *
16313 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16314 */
16315void
16316watchdog_set_poll_interval (Watchdog *object, gint value)
16317{
16318 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
16319}
16320
16321/**
16322 * watchdog_emit_watchdog_error:
16323 * @object: A #Watchdog.
16324 *
16325 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
16326 */
16327void
16328watchdog_emit_watchdog_error (
16329 Watchdog *object)
16330{
16331 g_signal_emit_by_name (object, "watchdog-error");
16332}
16333
16334/**
16335 * watchdog_call_start:
16336 * @proxy: A #WatchdogProxy.
16337 * @cancellable: (allow-none): A #GCancellable or %NULL.
16338 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16339 * @user_data: User data to pass to @callback.
16340 *
16341 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
16342 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16343 * You can then call watchdog_call_start_finish() to get the result of the operation.
16344 *
16345 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
16346 */
16347void
16348watchdog_call_start (
16349 Watchdog *proxy,
16350 GCancellable *cancellable,
16351 GAsyncReadyCallback callback,
16352 gpointer user_data)
16353{
16354 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16355 "start",
16356 g_variant_new ("()"),
16357 G_DBUS_CALL_FLAGS_NONE,
16358 -1,
16359 cancellable,
16360 callback,
16361 user_data);
16362}
16363
16364/**
16365 * watchdog_call_start_finish:
16366 * @proxy: A #WatchdogProxy.
16367 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
16368 * @error: Return location for error or %NULL.
16369 *
16370 * Finishes an operation started with watchdog_call_start().
16371 *
16372 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16373 */
16374gboolean
16375watchdog_call_start_finish (
16376 Watchdog *proxy,
16377 GAsyncResult *res,
16378 GError **error)
16379{
16380 GVariant *_ret;
16381 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16382 if (_ret == NULL)
16383 goto _out;
16384 g_variant_get (_ret,
16385 "()");
16386 g_variant_unref (_ret);
16387_out:
16388 return _ret != NULL;
16389}
16390
16391/**
16392 * watchdog_call_start_sync:
16393 * @proxy: A #WatchdogProxy.
16394 * @cancellable: (allow-none): A #GCancellable or %NULL.
16395 * @error: Return location for error or %NULL.
16396 *
16397 * 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.
16398 *
16399 * See watchdog_call_start() for the asynchronous version of this method.
16400 *
16401 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16402 */
16403gboolean
16404watchdog_call_start_sync (
16405 Watchdog *proxy,
16406 GCancellable *cancellable,
16407 GError **error)
16408{
16409 GVariant *_ret;
16410 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16411 "start",
16412 g_variant_new ("()"),
16413 G_DBUS_CALL_FLAGS_NONE,
16414 -1,
16415 cancellable,
16416 error);
16417 if (_ret == NULL)
16418 goto _out;
16419 g_variant_get (_ret,
16420 "()");
16421 g_variant_unref (_ret);
16422_out:
16423 return _ret != NULL;
16424}
16425
16426/**
16427 * watchdog_call_poke:
16428 * @proxy: A #WatchdogProxy.
16429 * @cancellable: (allow-none): A #GCancellable or %NULL.
16430 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16431 * @user_data: User data to pass to @callback.
16432 *
16433 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
16434 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16435 * You can then call watchdog_call_poke_finish() to get the result of the operation.
16436 *
16437 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
16438 */
16439void
16440watchdog_call_poke (
16441 Watchdog *proxy,
16442 GCancellable *cancellable,
16443 GAsyncReadyCallback callback,
16444 gpointer user_data)
16445{
16446 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16447 "poke",
16448 g_variant_new ("()"),
16449 G_DBUS_CALL_FLAGS_NONE,
16450 -1,
16451 cancellable,
16452 callback,
16453 user_data);
16454}
16455
16456/**
16457 * watchdog_call_poke_finish:
16458 * @proxy: A #WatchdogProxy.
16459 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
16460 * @error: Return location for error or %NULL.
16461 *
16462 * Finishes an operation started with watchdog_call_poke().
16463 *
16464 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16465 */
16466gboolean
16467watchdog_call_poke_finish (
16468 Watchdog *proxy,
16469 GAsyncResult *res,
16470 GError **error)
16471{
16472 GVariant *_ret;
16473 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16474 if (_ret == NULL)
16475 goto _out;
16476 g_variant_get (_ret,
16477 "()");
16478 g_variant_unref (_ret);
16479_out:
16480 return _ret != NULL;
16481}
16482
16483/**
16484 * watchdog_call_poke_sync:
16485 * @proxy: A #WatchdogProxy.
16486 * @cancellable: (allow-none): A #GCancellable or %NULL.
16487 * @error: Return location for error or %NULL.
16488 *
16489 * 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.
16490 *
16491 * See watchdog_call_poke() for the asynchronous version of this method.
16492 *
16493 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16494 */
16495gboolean
16496watchdog_call_poke_sync (
16497 Watchdog *proxy,
16498 GCancellable *cancellable,
16499 GError **error)
16500{
16501 GVariant *_ret;
16502 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16503 "poke",
16504 g_variant_new ("()"),
16505 G_DBUS_CALL_FLAGS_NONE,
16506 -1,
16507 cancellable,
16508 error);
16509 if (_ret == NULL)
16510 goto _out;
16511 g_variant_get (_ret,
16512 "()");
16513 g_variant_unref (_ret);
16514_out:
16515 return _ret != NULL;
16516}
16517
16518/**
16519 * watchdog_call_stop:
16520 * @proxy: A #WatchdogProxy.
16521 * @cancellable: (allow-none): A #GCancellable or %NULL.
16522 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16523 * @user_data: User data to pass to @callback.
16524 *
16525 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
16526 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16527 * You can then call watchdog_call_stop_finish() to get the result of the operation.
16528 *
16529 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
16530 */
16531void
16532watchdog_call_stop (
16533 Watchdog *proxy,
16534 GCancellable *cancellable,
16535 GAsyncReadyCallback callback,
16536 gpointer user_data)
16537{
16538 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16539 "stop",
16540 g_variant_new ("()"),
16541 G_DBUS_CALL_FLAGS_NONE,
16542 -1,
16543 cancellable,
16544 callback,
16545 user_data);
16546}
16547
16548/**
16549 * watchdog_call_stop_finish:
16550 * @proxy: A #WatchdogProxy.
16551 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
16552 * @error: Return location for error or %NULL.
16553 *
16554 * Finishes an operation started with watchdog_call_stop().
16555 *
16556 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16557 */
16558gboolean
16559watchdog_call_stop_finish (
16560 Watchdog *proxy,
16561 GAsyncResult *res,
16562 GError **error)
16563{
16564 GVariant *_ret;
16565 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16566 if (_ret == NULL)
16567 goto _out;
16568 g_variant_get (_ret,
16569 "()");
16570 g_variant_unref (_ret);
16571_out:
16572 return _ret != NULL;
16573}
16574
16575/**
16576 * watchdog_call_stop_sync:
16577 * @proxy: A #WatchdogProxy.
16578 * @cancellable: (allow-none): A #GCancellable or %NULL.
16579 * @error: Return location for error or %NULL.
16580 *
16581 * 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.
16582 *
16583 * See watchdog_call_stop() for the asynchronous version of this method.
16584 *
16585 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16586 */
16587gboolean
16588watchdog_call_stop_sync (
16589 Watchdog *proxy,
16590 GCancellable *cancellable,
16591 GError **error)
16592{
16593 GVariant *_ret;
16594 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16595 "stop",
16596 g_variant_new ("()"),
16597 G_DBUS_CALL_FLAGS_NONE,
16598 -1,
16599 cancellable,
16600 error);
16601 if (_ret == NULL)
16602 goto _out;
16603 g_variant_get (_ret,
16604 "()");
16605 g_variant_unref (_ret);
16606_out:
16607 return _ret != NULL;
16608}
16609
16610/**
16611 * watchdog_complete_start:
16612 * @object: A #Watchdog.
16613 * @invocation: (transfer full): A #GDBusMethodInvocation.
16614 *
16615 * 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.
16616 *
16617 * This method will free @invocation, you cannot use it afterwards.
16618 */
16619void
16620watchdog_complete_start (
16621 Watchdog *object,
16622 GDBusMethodInvocation *invocation)
16623{
16624 g_dbus_method_invocation_return_value (invocation,
16625 g_variant_new ("()"));
16626}
16627
16628/**
16629 * watchdog_complete_poke:
16630 * @object: A #Watchdog.
16631 * @invocation: (transfer full): A #GDBusMethodInvocation.
16632 *
16633 * 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.
16634 *
16635 * This method will free @invocation, you cannot use it afterwards.
16636 */
16637void
16638watchdog_complete_poke (
16639 Watchdog *object,
16640 GDBusMethodInvocation *invocation)
16641{
16642 g_dbus_method_invocation_return_value (invocation,
16643 g_variant_new ("()"));
16644}
16645
16646/**
16647 * watchdog_complete_stop:
16648 * @object: A #Watchdog.
16649 * @invocation: (transfer full): A #GDBusMethodInvocation.
16650 *
16651 * 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.
16652 *
16653 * This method will free @invocation, you cannot use it afterwards.
16654 */
16655void
16656watchdog_complete_stop (
16657 Watchdog *object,
16658 GDBusMethodInvocation *invocation)
16659{
16660 g_dbus_method_invocation_return_value (invocation,
16661 g_variant_new ("()"));
16662}
16663
16664/* ------------------------------------------------------------------------ */
16665
16666/**
16667 * WatchdogProxy:
16668 *
16669 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
16670 */
16671
16672/**
16673 * WatchdogProxyClass:
16674 * @parent_class: The parent class.
16675 *
16676 * Class structure for #WatchdogProxy.
16677 */
16678
16679struct _WatchdogProxyPrivate
16680{
16681 GData *qdata;
16682};
16683
16684static void watchdog_proxy_iface_init (WatchdogIface *iface);
16685
16686#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16687G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
16688 G_ADD_PRIVATE (WatchdogProxy)
16689 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
16690
16691#else
16692G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
16693 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
16694
16695#endif
16696static void
16697watchdog_proxy_finalize (GObject *object)
16698{
16699 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16700 g_datalist_clear (&proxy->priv->qdata);
16701 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
16702}
16703
16704static void
16705watchdog_proxy_get_property (GObject *object,
16706 guint prop_id,
16707 GValue *value,
16708 GParamSpec *pspec G_GNUC_UNUSED)
16709{
16710 const _ExtendedGDBusPropertyInfo *info;
16711 GVariant *variant;
16712 g_assert (prop_id != 0 && prop_id - 1 < 2);
16713 info = _watchdog_property_info_pointers[prop_id - 1];
16714 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16715 if (info->use_gvariant)
16716 {
16717 g_value_set_variant (value, variant);
16718 }
16719 else
16720 {
16721 if (variant != NULL)
16722 g_dbus_gvariant_to_gvalue (variant, value);
16723 }
16724 if (variant != NULL)
16725 g_variant_unref (variant);
16726}
16727
16728static void
16729watchdog_proxy_set_property_cb (GDBusProxy *proxy,
16730 GAsyncResult *res,
16731 gpointer user_data)
16732{
16733 const _ExtendedGDBusPropertyInfo *info = user_data;
16734 GError *error;
16735 GVariant *_ret;
16736 error = NULL;
16737 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16738 if (!_ret)
16739 {
16740 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
16741 info->parent_struct.name,
16742 error->message, g_quark_to_string (error->domain), error->code);
16743 g_error_free (error);
16744 }
16745 else
16746 {
16747 g_variant_unref (_ret);
16748 }
16749}
16750
16751static void
16752watchdog_proxy_set_property (GObject *object,
16753 guint prop_id,
16754 const GValue *value,
16755 GParamSpec *pspec G_GNUC_UNUSED)
16756{
16757 const _ExtendedGDBusPropertyInfo *info;
16758 GVariant *variant;
16759 g_assert (prop_id != 0 && prop_id - 1 < 2);
16760 info = _watchdog_property_info_pointers[prop_id - 1];
16761 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16762 g_dbus_proxy_call (G_DBUS_PROXY (object),
16763 "org.freedesktop.DBus.Properties.Set",
16764 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
16765 G_DBUS_CALL_FLAGS_NONE,
16766 -1,
16767 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16768 g_variant_unref (variant);
16769}
16770
16771static void
16772watchdog_proxy_g_signal (GDBusProxy *proxy,
16773 const gchar *sender_name G_GNUC_UNUSED,
16774 const gchar *signal_name,
16775 GVariant *parameters)
16776{
16777 _ExtendedGDBusSignalInfo *info;
16778 GVariantIter iter;
16779 GVariant *child;
16780 GValue *paramv;
16781 guint num_params;
16782 guint n;
16783 guint signal_id;
16784 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
16785 if (info == NULL)
16786 return;
16787 num_params = g_variant_n_children (parameters);
16788 paramv = g_new0 (GValue, num_params + 1);
16789 g_value_init (&paramv[0], TYPE_WATCHDOG);
16790 g_value_set_object (&paramv[0], proxy);
16791 g_variant_iter_init (&iter, parameters);
16792 n = 1;
16793 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16794 {
16795 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16796 if (arg_info->use_gvariant)
16797 {
16798 g_value_init (&paramv[n], G_TYPE_VARIANT);
16799 g_value_set_variant (&paramv[n], child);
16800 n++;
16801 }
16802 else
16803 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16804 g_variant_unref (child);
16805 }
16806 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
16807 g_signal_emitv (paramv, signal_id, 0, NULL);
16808 for (n = 0; n < num_params + 1; n++)
16809 g_value_unset (&paramv[n]);
16810 g_free (paramv);
16811}
16812
16813static void
16814watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
16815 GVariant *changed_properties,
16816 const gchar *const *invalidated_properties)
16817{
16818 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
16819 guint n;
16820 const gchar *key;
16821 GVariantIter *iter;
16822 _ExtendedGDBusPropertyInfo *info;
16823 g_variant_get (changed_properties, "a{sv}", &iter);
16824 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16825 {
16826 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
16827 g_datalist_remove_data (&proxy->priv->qdata, key);
16828 if (info != NULL)
16829 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16830 }
16831 g_variant_iter_free (iter);
16832 for (n = 0; invalidated_properties[n] != NULL; n++)
16833 {
16834 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
16835 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16836 if (info != NULL)
16837 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16838 }
16839}
16840
16841static gint
16842watchdog_proxy_get_watchdog (Watchdog *object)
16843{
16844 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16845 GVariant *variant;
16846 gint value = 0;
16847 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
16848 if (variant != NULL)
16849 {
16850 value = g_variant_get_int32 (variant);
16851 g_variant_unref (variant);
16852 }
16853 return value;
16854}
16855
16856static gint
16857watchdog_proxy_get_poll_interval (Watchdog *object)
16858{
16859 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16860 GVariant *variant;
16861 gint value = 0;
16862 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
16863 if (variant != NULL)
16864 {
16865 value = g_variant_get_int32 (variant);
16866 g_variant_unref (variant);
16867 }
16868 return value;
16869}
16870
16871static void
16872watchdog_proxy_init (WatchdogProxy *proxy)
16873{
16874#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16875 proxy->priv = watchdog_proxy_get_instance_private (proxy);
16876#else
16877 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
16878#endif
16879
16880 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
16881}
16882
16883static void
16884watchdog_proxy_class_init (WatchdogProxyClass *klass)
16885{
16886 GObjectClass *gobject_class;
16887 GDBusProxyClass *proxy_class;
16888
16889 gobject_class = G_OBJECT_CLASS (klass);
16890 gobject_class->finalize = watchdog_proxy_finalize;
16891 gobject_class->get_property = watchdog_proxy_get_property;
16892 gobject_class->set_property = watchdog_proxy_set_property;
16893
16894 proxy_class = G_DBUS_PROXY_CLASS (klass);
16895 proxy_class->g_signal = watchdog_proxy_g_signal;
16896 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
16897
16898 watchdog_override_properties (gobject_class, 1);
16899
16900#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16901 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
16902#endif
16903}
16904
16905static void
16906watchdog_proxy_iface_init (WatchdogIface *iface)
16907{
16908 iface->get_watchdog = watchdog_proxy_get_watchdog;
16909 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
16910}
16911
16912/**
16913 * watchdog_proxy_new:
16914 * @connection: A #GDBusConnection.
16915 * @flags: Flags from the #GDBusProxyFlags enumeration.
16916 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16917 * @object_path: An object path.
16918 * @cancellable: (allow-none): A #GCancellable or %NULL.
16919 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16920 * @user_data: User data to pass to @callback.
16921 *
16922 * 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.
16923 *
16924 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16925 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
16926 *
16927 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
16928 */
16929void
16930watchdog_proxy_new (
16931 GDBusConnection *connection,
16932 GDBusProxyFlags flags,
16933 const gchar *name,
16934 const gchar *object_path,
16935 GCancellable *cancellable,
16936 GAsyncReadyCallback callback,
16937 gpointer user_data)
16938{
16939 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);
16940}
16941
16942/**
16943 * watchdog_proxy_new_finish:
16944 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
16945 * @error: Return location for error or %NULL
16946 *
16947 * Finishes an operation started with watchdog_proxy_new().
16948 *
16949 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
16950 */
16951Watchdog *
16952watchdog_proxy_new_finish (
16953 GAsyncResult *res,
16954 GError **error)
16955{
16956 GObject *ret;
16957 GObject *source_object;
16958 source_object = g_async_result_get_source_object (res);
16959 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16960 g_object_unref (source_object);
16961 if (ret != NULL)
16962 return WATCHDOG (ret);
16963 else
16964 return NULL;
16965}
16966
16967/**
16968 * watchdog_proxy_new_sync:
16969 * @connection: A #GDBusConnection.
16970 * @flags: Flags from the #GDBusProxyFlags enumeration.
16971 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16972 * @object_path: An object path.
16973 * @cancellable: (allow-none): A #GCancellable or %NULL.
16974 * @error: Return location for error or %NULL
16975 *
16976 * 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.
16977 *
16978 * The calling thread is blocked until a reply is received.
16979 *
16980 * See watchdog_proxy_new() for the asynchronous version of this constructor.
16981 *
16982 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
16983 */
16984Watchdog *
16985watchdog_proxy_new_sync (
16986 GDBusConnection *connection,
16987 GDBusProxyFlags flags,
16988 const gchar *name,
16989 const gchar *object_path,
16990 GCancellable *cancellable,
16991 GError **error)
16992{
16993 GInitable *ret;
16994 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);
16995 if (ret != NULL)
16996 return WATCHDOG (ret);
16997 else
16998 return NULL;
16999}
17000
17001
17002/**
17003 * watchdog_proxy_new_for_bus:
17004 * @bus_type: A #GBusType.
17005 * @flags: Flags from the #GDBusProxyFlags enumeration.
17006 * @name: A bus name (well-known or unique).
17007 * @object_path: An object path.
17008 * @cancellable: (allow-none): A #GCancellable or %NULL.
17009 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17010 * @user_data: User data to pass to @callback.
17011 *
17012 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17013 *
17014 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17015 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
17016 *
17017 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17018 */
17019void
17020watchdog_proxy_new_for_bus (
17021 GBusType bus_type,
17022 GDBusProxyFlags flags,
17023 const gchar *name,
17024 const gchar *object_path,
17025 GCancellable *cancellable,
17026 GAsyncReadyCallback callback,
17027 gpointer user_data)
17028{
17029 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);
17030}
17031
17032/**
17033 * watchdog_proxy_new_for_bus_finish:
17034 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
17035 * @error: Return location for error or %NULL
17036 *
17037 * Finishes an operation started with watchdog_proxy_new_for_bus().
17038 *
17039 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17040 */
17041Watchdog *
17042watchdog_proxy_new_for_bus_finish (
17043 GAsyncResult *res,
17044 GError **error)
17045{
17046 GObject *ret;
17047 GObject *source_object;
17048 source_object = g_async_result_get_source_object (res);
17049 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17050 g_object_unref (source_object);
17051 if (ret != NULL)
17052 return WATCHDOG (ret);
17053 else
17054 return NULL;
17055}
17056
17057/**
17058 * watchdog_proxy_new_for_bus_sync:
17059 * @bus_type: A #GBusType.
17060 * @flags: Flags from the #GDBusProxyFlags enumeration.
17061 * @name: A bus name (well-known or unique).
17062 * @object_path: An object path.
17063 * @cancellable: (allow-none): A #GCancellable or %NULL.
17064 * @error: Return location for error or %NULL
17065 *
17066 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17067 *
17068 * The calling thread is blocked until a reply is received.
17069 *
17070 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
17071 *
17072 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17073 */
17074Watchdog *
17075watchdog_proxy_new_for_bus_sync (
17076 GBusType bus_type,
17077 GDBusProxyFlags flags,
17078 const gchar *name,
17079 const gchar *object_path,
17080 GCancellable *cancellable,
17081 GError **error)
17082{
17083 GInitable *ret;
17084 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);
17085 if (ret != NULL)
17086 return WATCHDOG (ret);
17087 else
17088 return NULL;
17089}
17090
17091
17092/* ------------------------------------------------------------------------ */
17093
17094/**
17095 * WatchdogSkeleton:
17096 *
17097 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
17098 */
17099
17100/**
17101 * WatchdogSkeletonClass:
17102 * @parent_class: The parent class.
17103 *
17104 * Class structure for #WatchdogSkeleton.
17105 */
17106
17107struct _WatchdogSkeletonPrivate
17108{
17109 GValue *properties;
17110 GList *changed_properties;
17111 GSource *changed_properties_idle_source;
17112 GMainContext *context;
17113 GMutex lock;
17114};
17115
17116static void
17117_watchdog_skeleton_handle_method_call (
17118 GDBusConnection *connection G_GNUC_UNUSED,
17119 const gchar *sender G_GNUC_UNUSED,
17120 const gchar *object_path G_GNUC_UNUSED,
17121 const gchar *interface_name,
17122 const gchar *method_name,
17123 GVariant *parameters,
17124 GDBusMethodInvocation *invocation,
17125 gpointer user_data)
17126{
17127 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17128 _ExtendedGDBusMethodInfo *info;
17129 GVariantIter iter;
17130 GVariant *child;
17131 GValue *paramv;
17132 guint num_params;
17133 guint num_extra;
17134 guint n;
17135 guint signal_id;
17136 GValue return_value = G_VALUE_INIT;
17137 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17138 g_assert (info != NULL);
17139 num_params = g_variant_n_children (parameters);
17140 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17141 n = 0;
17142 g_value_init (&paramv[n], TYPE_WATCHDOG);
17143 g_value_set_object (&paramv[n++], skeleton);
17144 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17145 g_value_set_object (&paramv[n++], invocation);
17146 if (info->pass_fdlist)
17147 {
17148#ifdef G_OS_UNIX
17149 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17150 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17151#else
17152 g_assert_not_reached ();
17153#endif
17154 }
17155 g_variant_iter_init (&iter, parameters);
17156 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17157 {
17158 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17159 if (arg_info->use_gvariant)
17160 {
17161 g_value_init (&paramv[n], G_TYPE_VARIANT);
17162 g_value_set_variant (&paramv[n], child);
17163 n++;
17164 }
17165 else
17166 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17167 g_variant_unref (child);
17168 }
17169 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
17170 g_value_init (&return_value, G_TYPE_BOOLEAN);
17171 g_signal_emitv (paramv, signal_id, 0, &return_value);
17172 if (!g_value_get_boolean (&return_value))
17173 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);
17174 g_value_unset (&return_value);
17175 for (n = 0; n < num_params + num_extra; n++)
17176 g_value_unset (&paramv[n]);
17177 g_free (paramv);
17178}
17179
17180static GVariant *
17181_watchdog_skeleton_handle_get_property (
17182 GDBusConnection *connection G_GNUC_UNUSED,
17183 const gchar *sender G_GNUC_UNUSED,
17184 const gchar *object_path G_GNUC_UNUSED,
17185 const gchar *interface_name G_GNUC_UNUSED,
17186 const gchar *property_name,
17187 GError **error,
17188 gpointer user_data)
17189{
17190 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17191 GValue value = G_VALUE_INIT;
17192 GParamSpec *pspec;
17193 _ExtendedGDBusPropertyInfo *info;
17194 GVariant *ret;
17195 ret = NULL;
17196 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17197 g_assert (info != NULL);
17198 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17199 if (pspec == NULL)
17200 {
17201 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17202 }
17203 else
17204 {
17205 g_value_init (&value, pspec->value_type);
17206 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17207 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17208 g_value_unset (&value);
17209 }
17210 return ret;
17211}
17212
17213static gboolean
17214_watchdog_skeleton_handle_set_property (
17215 GDBusConnection *connection G_GNUC_UNUSED,
17216 const gchar *sender G_GNUC_UNUSED,
17217 const gchar *object_path G_GNUC_UNUSED,
17218 const gchar *interface_name G_GNUC_UNUSED,
17219 const gchar *property_name,
17220 GVariant *variant,
17221 GError **error,
17222 gpointer user_data)
17223{
17224 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17225 GValue value = G_VALUE_INIT;
17226 GParamSpec *pspec;
17227 _ExtendedGDBusPropertyInfo *info;
17228 gboolean ret;
17229 ret = FALSE;
17230 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17231 g_assert (info != NULL);
17232 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17233 if (pspec == NULL)
17234 {
17235 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17236 }
17237 else
17238 {
17239 if (info->use_gvariant)
17240 g_value_set_variant (&value, variant);
17241 else
17242 g_dbus_gvariant_to_gvalue (variant, &value);
17243 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17244 g_value_unset (&value);
17245 ret = TRUE;
17246 }
17247 return ret;
17248}
17249
17250static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
17251{
17252 _watchdog_skeleton_handle_method_call,
17253 _watchdog_skeleton_handle_get_property,
17254 _watchdog_skeleton_handle_set_property,
17255 {NULL}
17256};
17257
17258static GDBusInterfaceInfo *
17259watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17260{
17261 return watchdog_interface_info ();
17262}
17263
17264static GDBusInterfaceVTable *
17265watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17266{
17267 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
17268}
17269
17270static GVariant *
17271watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17272{
17273 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17274
17275 GVariantBuilder builder;
17276 guint n;
17277 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17278 if (_watchdog_interface_info.parent_struct.properties == NULL)
17279 goto out;
17280 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
17281 {
17282 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
17283 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17284 {
17285 GVariant *value;
17286 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);
17287 if (value != NULL)
17288 {
17289 g_variant_take_ref (value);
17290 g_variant_builder_add (&builder, "{sv}", info->name, value);
17291 g_variant_unref (value);
17292 }
17293 }
17294 }
17295out:
17296 return g_variant_builder_end (&builder);
17297}
17298
17299static gboolean _watchdog_emit_changed (gpointer user_data);
17300
17301static void
17302watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17303{
17304 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17305 gboolean emit_changed = FALSE;
17306
17307 g_mutex_lock (&skeleton->priv->lock);
17308 if (skeleton->priv->changed_properties_idle_source != NULL)
17309 {
17310 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17311 skeleton->priv->changed_properties_idle_source = NULL;
17312 emit_changed = TRUE;
17313 }
17314 g_mutex_unlock (&skeleton->priv->lock);
17315
17316 if (emit_changed)
17317 _watchdog_emit_changed (skeleton);
17318}
17319
17320static void
17321_watchdog_on_signal_watchdog_error (
17322 Watchdog *object)
17323{
17324 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17325
17326 GList *connections, *l;
17327 GVariant *signal_variant;
17328 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17329
17330 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17331 for (l = connections; l != NULL; l = l->next)
17332 {
17333 GDBusConnection *connection = l->data;
17334 g_dbus_connection_emit_signal (connection,
17335 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
17336 signal_variant, NULL);
17337 }
17338 g_variant_unref (signal_variant);
17339 g_list_free_full (connections, g_object_unref);
17340}
17341
17342static void watchdog_skeleton_iface_init (WatchdogIface *iface);
17343#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17344G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17345 G_ADD_PRIVATE (WatchdogSkeleton)
17346 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17347
17348#else
17349G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17350 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17351
17352#endif
17353static void
17354watchdog_skeleton_finalize (GObject *object)
17355{
17356 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17357 guint n;
17358 for (n = 0; n < 2; n++)
17359 g_value_unset (&skeleton->priv->properties[n]);
17360 g_free (skeleton->priv->properties);
17361 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17362 if (skeleton->priv->changed_properties_idle_source != NULL)
17363 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17364 g_main_context_unref (skeleton->priv->context);
17365 g_mutex_clear (&skeleton->priv->lock);
17366 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
17367}
17368
17369static void
17370watchdog_skeleton_get_property (GObject *object,
17371 guint prop_id,
17372 GValue *value,
17373 GParamSpec *pspec G_GNUC_UNUSED)
17374{
17375 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17376 g_assert (prop_id != 0 && prop_id - 1 < 2);
17377 g_mutex_lock (&skeleton->priv->lock);
17378 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17379 g_mutex_unlock (&skeleton->priv->lock);
17380}
17381
17382static gboolean
17383_watchdog_emit_changed (gpointer user_data)
17384{
17385 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17386 GList *l;
17387 GVariantBuilder builder;
17388 GVariantBuilder invalidated_builder;
17389 guint num_changes;
17390
17391 g_mutex_lock (&skeleton->priv->lock);
17392 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17393 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17394 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17395 {
17396 ChangedProperty *cp = l->data;
17397 GVariant *variant;
17398 const GValue *cur_value;
17399
17400 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17401 if (!_g_value_equal (cur_value, &cp->orig_value))
17402 {
17403 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17404 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17405 g_variant_unref (variant);
17406 num_changes++;
17407 }
17408 }
17409 if (num_changes > 0)
17410 {
17411 GList *connections, *ll;
17412 GVariant *signal_variant;
17413 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
17414 &builder, &invalidated_builder));
17415 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17416 for (ll = connections; ll != NULL; ll = ll->next)
17417 {
17418 GDBusConnection *connection = ll->data;
17419
17420 g_dbus_connection_emit_signal (connection,
17421 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17422 "org.freedesktop.DBus.Properties",
17423 "PropertiesChanged",
17424 signal_variant,
17425 NULL);
17426 }
17427 g_variant_unref (signal_variant);
17428 g_list_free_full (connections, g_object_unref);
17429 }
17430 else
17431 {
17432 g_variant_builder_clear (&builder);
17433 g_variant_builder_clear (&invalidated_builder);
17434 }
17435 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17436 skeleton->priv->changed_properties = NULL;
17437 skeleton->priv->changed_properties_idle_source = NULL;
17438 g_mutex_unlock (&skeleton->priv->lock);
17439 return FALSE;
17440}
17441
17442static void
17443_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17444{
17445 ChangedProperty *cp;
17446 GList *l;
17447 cp = NULL;
17448 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17449 {
17450 ChangedProperty *i_cp = l->data;
17451 if (i_cp->info == info)
17452 {
17453 cp = i_cp;
17454 break;
17455 }
17456 }
17457 if (cp == NULL)
17458 {
17459 cp = g_new0 (ChangedProperty, 1);
17460 cp->prop_id = prop_id;
17461 cp->info = info;
17462 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17463 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17464 g_value_copy (orig_value, &cp->orig_value);
17465 }
17466}
17467
17468static void
17469watchdog_skeleton_notify (GObject *object,
17470 GParamSpec *pspec G_GNUC_UNUSED)
17471{
17472 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17473 g_mutex_lock (&skeleton->priv->lock);
17474 if (skeleton->priv->changed_properties != NULL &&
17475 skeleton->priv->changed_properties_idle_source == NULL)
17476 {
17477 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17478 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17479 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
17480 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17481 g_source_unref (skeleton->priv->changed_properties_idle_source);
17482 }
17483 g_mutex_unlock (&skeleton->priv->lock);
17484}
17485
17486static void
17487watchdog_skeleton_set_property (GObject *object,
17488 guint prop_id,
17489 const GValue *value,
17490 GParamSpec *pspec)
17491{
17492 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17493 g_assert (prop_id != 0 && prop_id - 1 < 2);
17494 g_mutex_lock (&skeleton->priv->lock);
17495 g_object_freeze_notify (object);
17496 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17497 {
17498 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17499 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17500 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17501 g_object_notify_by_pspec (object, pspec);
17502 }
17503 g_mutex_unlock (&skeleton->priv->lock);
17504 g_object_thaw_notify (object);
17505}
17506
17507static void
17508watchdog_skeleton_init (WatchdogSkeleton *skeleton)
17509{
17510#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17511 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
17512#else
17513 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
17514#endif
17515
17516 g_mutex_init (&skeleton->priv->lock);
17517 skeleton->priv->context = g_main_context_ref_thread_default ();
17518 skeleton->priv->properties = g_new0 (GValue, 2);
17519 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17520 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
17521}
17522
17523static gint
17524watchdog_skeleton_get_watchdog (Watchdog *object)
17525{
17526 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17527 gint value;
17528 g_mutex_lock (&skeleton->priv->lock);
17529 value = g_value_get_int (&(skeleton->priv->properties[0]));
17530 g_mutex_unlock (&skeleton->priv->lock);
17531 return value;
17532}
17533
17534static gint
17535watchdog_skeleton_get_poll_interval (Watchdog *object)
17536{
17537 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17538 gint value;
17539 g_mutex_lock (&skeleton->priv->lock);
17540 value = g_value_get_int (&(skeleton->priv->properties[1]));
17541 g_mutex_unlock (&skeleton->priv->lock);
17542 return value;
17543}
17544
17545static void
17546watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
17547{
17548 GObjectClass *gobject_class;
17549 GDBusInterfaceSkeletonClass *skeleton_class;
17550
17551 gobject_class = G_OBJECT_CLASS (klass);
17552 gobject_class->finalize = watchdog_skeleton_finalize;
17553 gobject_class->get_property = watchdog_skeleton_get_property;
17554 gobject_class->set_property = watchdog_skeleton_set_property;
17555 gobject_class->notify = watchdog_skeleton_notify;
17556
17557
17558 watchdog_override_properties (gobject_class, 1);
17559
17560 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17561 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
17562 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
17563 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
17564 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
17565
17566#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17567 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
17568#endif
17569}
17570
17571static void
17572watchdog_skeleton_iface_init (WatchdogIface *iface)
17573{
17574 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
17575 iface->get_watchdog = watchdog_skeleton_get_watchdog;
17576 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
17577}
17578
17579/**
17580 * watchdog_skeleton_new:
17581 *
17582 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17583 *
17584 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
17585 */
17586Watchdog *
17587watchdog_skeleton_new (void)
17588{
17589 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
17590}
17591
17592/* ------------------------------------------------------------------------
17593 * Code for interface org.openbmc.EventLog
17594 * ------------------------------------------------------------------------
17595 */
17596
17597/**
17598 * SECTION:EventLog
17599 * @title: EventLog
17600 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
17601 *
17602 * 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.
17603 */
17604
17605/* ---- Introspection data for org.openbmc.EventLog ---- */
17606
Norman James2d1ee892015-09-16 23:13:45 -050017607static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
17608{
17609 {
17610 -1,
17611 (gchar *) "log",
17612 (gchar *) "a(s)",
17613 NULL
17614 },
17615 FALSE
17616};
17617
17618static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
17619{
17620 &_event_log_method_info_get_event_log_OUT_ARG_log,
17621 NULL
17622};
17623
17624static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
17625{
17626 {
17627 -1,
17628 (gchar *) "getEventLog",
17629 NULL,
17630 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
17631 NULL
17632 },
17633 "handle-get-event-log",
17634 FALSE
17635};
17636
17637static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
17638{
17639 &_event_log_method_info_get_event_log,
17640 NULL
17641};
17642
Norman James8abb50c2015-09-16 10:58:16 -050017643static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050017644{
17645 {
17646 -1,
Norman James8abb50c2015-09-16 10:58:16 -050017647 (gchar *) "priority",
17648 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050017649 NULL
17650 },
17651 FALSE
17652};
17653
Norman James362a80f2015-09-14 14:04:39 -050017654static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
17655{
17656 {
17657 -1,
17658 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050017659 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050017660 NULL
17661 },
17662 FALSE
17663};
17664
Norman James88872672015-09-21 16:51:35 -050017665static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
17666{
17667 {
17668 -1,
17669 (gchar *) "rc",
17670 (gchar *) "i",
17671 NULL
17672 },
17673 FALSE
17674};
17675
Norman James362a80f2015-09-14 14:04:39 -050017676static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
17677{
Norman James8abb50c2015-09-16 10:58:16 -050017678 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050017679 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050017680 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050017681 NULL
17682};
17683
17684static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
17685{
17686 {
17687 -1,
17688 (gchar *) "EventLog",
17689 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
17690 NULL
17691 },
17692 "event-log"
17693};
17694
17695static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
17696{
17697 &_event_log_signal_info_event_log,
17698 NULL
17699};
17700
Norman James362a80f2015-09-14 14:04:39 -050017701static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
17702{
17703 {
17704 -1,
17705 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050017706 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050017707 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050017708 NULL,
Norman James362a80f2015-09-14 14:04:39 -050017709 NULL
17710 },
17711 "event-log",
17712};
17713
17714
17715/**
17716 * event_log_interface_info:
17717 *
17718 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
17719 *
17720 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17721 */
17722GDBusInterfaceInfo *
17723event_log_interface_info (void)
17724{
17725 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
17726}
17727
17728/**
17729 * event_log_override_properties:
17730 * @klass: The class structure for a #GObject<!-- -->-derived class.
17731 * @property_id_begin: The property id to assign to the first overridden property.
17732 *
17733 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
17734 * The properties are overridden in the order they are defined.
17735 *
17736 * Returns: The last property id.
17737 */
17738guint
17739event_log_override_properties (GObjectClass *klass, guint property_id_begin)
17740{
Norman James362a80f2015-09-14 14:04:39 -050017741 return property_id_begin - 1;
17742}
17743
17744
17745
17746/**
17747 * EventLog:
17748 *
17749 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
17750 */
17751
17752/**
17753 * EventLogIface:
17754 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050017755 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050017756 * @event_log: Handler for the #EventLog::event-log signal.
17757 *
17758 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
17759 */
17760
17761typedef EventLogIface EventLogInterface;
17762G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
17763
17764static void
17765event_log_default_init (EventLogIface *iface)
17766{
Norman James2d1ee892015-09-16 23:13:45 -050017767 /* GObject signals for incoming D-Bus method calls: */
17768 /**
17769 * EventLog::handle-get-event-log:
17770 * @object: A #EventLog.
17771 * @invocation: A #GDBusMethodInvocation.
17772 *
17773 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
17774 *
17775 * 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.
17776 *
17777 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17778 */
17779 g_signal_new ("handle-get-event-log",
17780 G_TYPE_FROM_INTERFACE (iface),
17781 G_SIGNAL_RUN_LAST,
17782 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
17783 g_signal_accumulator_true_handled,
17784 NULL,
17785 g_cclosure_marshal_generic,
17786 G_TYPE_BOOLEAN,
17787 1,
17788 G_TYPE_DBUS_METHOD_INVOCATION);
17789
Norman James362a80f2015-09-14 14:04:39 -050017790 /* GObject signals for received D-Bus signals: */
17791 /**
17792 * EventLog::event-log:
17793 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050017794 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050017795 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050017796 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050017797 *
17798 * 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.
17799 *
17800 * 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.
17801 */
17802 g_signal_new ("event-log",
17803 G_TYPE_FROM_INTERFACE (iface),
17804 G_SIGNAL_RUN_LAST,
17805 G_STRUCT_OFFSET (EventLogIface, event_log),
17806 NULL,
17807 NULL,
17808 g_cclosure_marshal_generic,
17809 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050017810 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050017811
Norman James362a80f2015-09-14 14:04:39 -050017812}
17813
17814/**
17815 * event_log_emit_event_log:
17816 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050017817 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050017818 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050017819 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050017820 *
17821 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
17822 */
17823void
17824event_log_emit_event_log (
17825 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050017826 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050017827 const gchar *arg_message,
17828 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050017829{
Norman James88872672015-09-21 16:51:35 -050017830 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050017831}
17832
Norman James2d1ee892015-09-16 23:13:45 -050017833/**
17834 * event_log_call_get_event_log:
17835 * @proxy: A #EventLogProxy.
17836 * @cancellable: (allow-none): A #GCancellable or %NULL.
17837 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17838 * @user_data: User data to pass to @callback.
17839 *
17840 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
17841 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17842 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
17843 *
17844 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
17845 */
17846void
17847event_log_call_get_event_log (
17848 EventLog *proxy,
17849 GCancellable *cancellable,
17850 GAsyncReadyCallback callback,
17851 gpointer user_data)
17852{
17853 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17854 "getEventLog",
17855 g_variant_new ("()"),
17856 G_DBUS_CALL_FLAGS_NONE,
17857 -1,
17858 cancellable,
17859 callback,
17860 user_data);
17861}
17862
17863/**
17864 * event_log_call_get_event_log_finish:
17865 * @proxy: A #EventLogProxy.
17866 * @out_log: (out): Return location for return parameter or %NULL to ignore.
17867 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
17868 * @error: Return location for error or %NULL.
17869 *
17870 * Finishes an operation started with event_log_call_get_event_log().
17871 *
17872 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17873 */
17874gboolean
17875event_log_call_get_event_log_finish (
17876 EventLog *proxy,
17877 GVariant **out_log,
17878 GAsyncResult *res,
17879 GError **error)
17880{
17881 GVariant *_ret;
17882 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17883 if (_ret == NULL)
17884 goto _out;
17885 g_variant_get (_ret,
17886 "(@a(s))",
17887 out_log);
17888 g_variant_unref (_ret);
17889_out:
17890 return _ret != NULL;
17891}
17892
17893/**
17894 * event_log_call_get_event_log_sync:
17895 * @proxy: A #EventLogProxy.
17896 * @out_log: (out): Return location for return parameter or %NULL to ignore.
17897 * @cancellable: (allow-none): A #GCancellable or %NULL.
17898 * @error: Return location for error or %NULL.
17899 *
17900 * 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.
17901 *
17902 * See event_log_call_get_event_log() for the asynchronous version of this method.
17903 *
17904 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17905 */
17906gboolean
17907event_log_call_get_event_log_sync (
17908 EventLog *proxy,
17909 GVariant **out_log,
17910 GCancellable *cancellable,
17911 GError **error)
17912{
17913 GVariant *_ret;
17914 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17915 "getEventLog",
17916 g_variant_new ("()"),
17917 G_DBUS_CALL_FLAGS_NONE,
17918 -1,
17919 cancellable,
17920 error);
17921 if (_ret == NULL)
17922 goto _out;
17923 g_variant_get (_ret,
17924 "(@a(s))",
17925 out_log);
17926 g_variant_unref (_ret);
17927_out:
17928 return _ret != NULL;
17929}
17930
17931/**
17932 * event_log_complete_get_event_log:
17933 * @object: A #EventLog.
17934 * @invocation: (transfer full): A #GDBusMethodInvocation.
17935 * @log: Parameter to return.
17936 *
17937 * 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.
17938 *
17939 * This method will free @invocation, you cannot use it afterwards.
17940 */
17941void
17942event_log_complete_get_event_log (
17943 EventLog *object,
17944 GDBusMethodInvocation *invocation,
17945 GVariant *log)
17946{
17947 g_dbus_method_invocation_return_value (invocation,
17948 g_variant_new ("(@a(s))",
17949 log));
17950}
17951
Norman James362a80f2015-09-14 14:04:39 -050017952/* ------------------------------------------------------------------------ */
17953
17954/**
17955 * EventLogProxy:
17956 *
17957 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
17958 */
17959
17960/**
17961 * EventLogProxyClass:
17962 * @parent_class: The parent class.
17963 *
17964 * Class structure for #EventLogProxy.
17965 */
17966
17967struct _EventLogProxyPrivate
17968{
17969 GData *qdata;
17970};
17971
17972static void event_log_proxy_iface_init (EventLogIface *iface);
17973
17974#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17975G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
17976 G_ADD_PRIVATE (EventLogProxy)
17977 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
17978
17979#else
17980G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
17981 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
17982
17983#endif
17984static void
17985event_log_proxy_finalize (GObject *object)
17986{
17987 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
17988 g_datalist_clear (&proxy->priv->qdata);
17989 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
17990}
17991
17992static void
17993event_log_proxy_get_property (GObject *object,
17994 guint prop_id,
17995 GValue *value,
17996 GParamSpec *pspec G_GNUC_UNUSED)
17997{
Norman James362a80f2015-09-14 14:04:39 -050017998}
17999
18000static void
18001event_log_proxy_set_property (GObject *object,
18002 guint prop_id,
18003 const GValue *value,
18004 GParamSpec *pspec G_GNUC_UNUSED)
18005{
Norman James362a80f2015-09-14 14:04:39 -050018006}
18007
18008static void
18009event_log_proxy_g_signal (GDBusProxy *proxy,
18010 const gchar *sender_name G_GNUC_UNUSED,
18011 const gchar *signal_name,
18012 GVariant *parameters)
18013{
18014 _ExtendedGDBusSignalInfo *info;
18015 GVariantIter iter;
18016 GVariant *child;
18017 GValue *paramv;
18018 guint num_params;
18019 guint n;
18020 guint signal_id;
18021 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
18022 if (info == NULL)
18023 return;
18024 num_params = g_variant_n_children (parameters);
18025 paramv = g_new0 (GValue, num_params + 1);
18026 g_value_init (&paramv[0], TYPE_EVENT_LOG);
18027 g_value_set_object (&paramv[0], proxy);
18028 g_variant_iter_init (&iter, parameters);
18029 n = 1;
18030 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18031 {
18032 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18033 if (arg_info->use_gvariant)
18034 {
18035 g_value_init (&paramv[n], G_TYPE_VARIANT);
18036 g_value_set_variant (&paramv[n], child);
18037 n++;
18038 }
18039 else
18040 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18041 g_variant_unref (child);
18042 }
18043 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18044 g_signal_emitv (paramv, signal_id, 0, NULL);
18045 for (n = 0; n < num_params + 1; n++)
18046 g_value_unset (&paramv[n]);
18047 g_free (paramv);
18048}
18049
18050static void
18051event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
18052 GVariant *changed_properties,
18053 const gchar *const *invalidated_properties)
18054{
18055 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
18056 guint n;
18057 const gchar *key;
18058 GVariantIter *iter;
18059 _ExtendedGDBusPropertyInfo *info;
18060 g_variant_get (changed_properties, "a{sv}", &iter);
18061 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18062 {
18063 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
18064 g_datalist_remove_data (&proxy->priv->qdata, key);
18065 if (info != NULL)
18066 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18067 }
18068 g_variant_iter_free (iter);
18069 for (n = 0; invalidated_properties[n] != NULL; n++)
18070 {
18071 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
18072 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18073 if (info != NULL)
18074 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18075 }
18076}
18077
Norman James362a80f2015-09-14 14:04:39 -050018078static void
18079event_log_proxy_init (EventLogProxy *proxy)
18080{
18081#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18082 proxy->priv = event_log_proxy_get_instance_private (proxy);
18083#else
18084 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
18085#endif
18086
18087 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
18088}
18089
18090static void
18091event_log_proxy_class_init (EventLogProxyClass *klass)
18092{
18093 GObjectClass *gobject_class;
18094 GDBusProxyClass *proxy_class;
18095
18096 gobject_class = G_OBJECT_CLASS (klass);
18097 gobject_class->finalize = event_log_proxy_finalize;
18098 gobject_class->get_property = event_log_proxy_get_property;
18099 gobject_class->set_property = event_log_proxy_set_property;
18100
18101 proxy_class = G_DBUS_PROXY_CLASS (klass);
18102 proxy_class->g_signal = event_log_proxy_g_signal;
18103 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
18104
Norman James362a80f2015-09-14 14:04:39 -050018105#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18106 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
18107#endif
18108}
18109
18110static void
18111event_log_proxy_iface_init (EventLogIface *iface)
18112{
Norman James362a80f2015-09-14 14:04:39 -050018113}
18114
18115/**
18116 * event_log_proxy_new:
18117 * @connection: A #GDBusConnection.
18118 * @flags: Flags from the #GDBusProxyFlags enumeration.
18119 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18120 * @object_path: An object path.
18121 * @cancellable: (allow-none): A #GCancellable or %NULL.
18122 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18123 * @user_data: User data to pass to @callback.
18124 *
18125 * 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.
18126 *
18127 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18128 * You can then call event_log_proxy_new_finish() to get the result of the operation.
18129 *
18130 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
18131 */
18132void
18133event_log_proxy_new (
18134 GDBusConnection *connection,
18135 GDBusProxyFlags flags,
18136 const gchar *name,
18137 const gchar *object_path,
18138 GCancellable *cancellable,
18139 GAsyncReadyCallback callback,
18140 gpointer user_data)
18141{
18142 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);
18143}
18144
18145/**
18146 * event_log_proxy_new_finish:
18147 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
18148 * @error: Return location for error or %NULL
18149 *
18150 * Finishes an operation started with event_log_proxy_new().
18151 *
18152 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18153 */
18154EventLog *
18155event_log_proxy_new_finish (
18156 GAsyncResult *res,
18157 GError **error)
18158{
18159 GObject *ret;
18160 GObject *source_object;
18161 source_object = g_async_result_get_source_object (res);
18162 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18163 g_object_unref (source_object);
18164 if (ret != NULL)
18165 return EVENT_LOG (ret);
18166 else
18167 return NULL;
18168}
18169
18170/**
18171 * event_log_proxy_new_sync:
18172 * @connection: A #GDBusConnection.
18173 * @flags: Flags from the #GDBusProxyFlags enumeration.
18174 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18175 * @object_path: An object path.
18176 * @cancellable: (allow-none): A #GCancellable or %NULL.
18177 * @error: Return location for error or %NULL
18178 *
18179 * 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.
18180 *
18181 * The calling thread is blocked until a reply is received.
18182 *
18183 * See event_log_proxy_new() for the asynchronous version of this constructor.
18184 *
18185 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18186 */
18187EventLog *
18188event_log_proxy_new_sync (
18189 GDBusConnection *connection,
18190 GDBusProxyFlags flags,
18191 const gchar *name,
18192 const gchar *object_path,
18193 GCancellable *cancellable,
18194 GError **error)
18195{
18196 GInitable *ret;
18197 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);
18198 if (ret != NULL)
18199 return EVENT_LOG (ret);
18200 else
18201 return NULL;
18202}
18203
18204
18205/**
18206 * event_log_proxy_new_for_bus:
18207 * @bus_type: A #GBusType.
18208 * @flags: Flags from the #GDBusProxyFlags enumeration.
18209 * @name: A bus name (well-known or unique).
18210 * @object_path: An object path.
18211 * @cancellable: (allow-none): A #GCancellable or %NULL.
18212 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18213 * @user_data: User data to pass to @callback.
18214 *
18215 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18216 *
18217 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18218 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
18219 *
18220 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18221 */
18222void
18223event_log_proxy_new_for_bus (
18224 GBusType bus_type,
18225 GDBusProxyFlags flags,
18226 const gchar *name,
18227 const gchar *object_path,
18228 GCancellable *cancellable,
18229 GAsyncReadyCallback callback,
18230 gpointer user_data)
18231{
18232 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);
18233}
18234
18235/**
18236 * event_log_proxy_new_for_bus_finish:
18237 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
18238 * @error: Return location for error or %NULL
18239 *
18240 * Finishes an operation started with event_log_proxy_new_for_bus().
18241 *
18242 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18243 */
18244EventLog *
18245event_log_proxy_new_for_bus_finish (
18246 GAsyncResult *res,
18247 GError **error)
18248{
18249 GObject *ret;
18250 GObject *source_object;
18251 source_object = g_async_result_get_source_object (res);
18252 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18253 g_object_unref (source_object);
18254 if (ret != NULL)
18255 return EVENT_LOG (ret);
18256 else
18257 return NULL;
18258}
18259
18260/**
18261 * event_log_proxy_new_for_bus_sync:
18262 * @bus_type: A #GBusType.
18263 * @flags: Flags from the #GDBusProxyFlags enumeration.
18264 * @name: A bus name (well-known or unique).
18265 * @object_path: An object path.
18266 * @cancellable: (allow-none): A #GCancellable or %NULL.
18267 * @error: Return location for error or %NULL
18268 *
18269 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18270 *
18271 * The calling thread is blocked until a reply is received.
18272 *
18273 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
18274 *
18275 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18276 */
18277EventLog *
18278event_log_proxy_new_for_bus_sync (
18279 GBusType bus_type,
18280 GDBusProxyFlags flags,
18281 const gchar *name,
18282 const gchar *object_path,
18283 GCancellable *cancellable,
18284 GError **error)
18285{
18286 GInitable *ret;
18287 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);
18288 if (ret != NULL)
18289 return EVENT_LOG (ret);
18290 else
18291 return NULL;
18292}
18293
18294
18295/* ------------------------------------------------------------------------ */
18296
18297/**
18298 * EventLogSkeleton:
18299 *
18300 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
18301 */
18302
18303/**
18304 * EventLogSkeletonClass:
18305 * @parent_class: The parent class.
18306 *
18307 * Class structure for #EventLogSkeleton.
18308 */
18309
18310struct _EventLogSkeletonPrivate
18311{
18312 GValue *properties;
18313 GList *changed_properties;
18314 GSource *changed_properties_idle_source;
18315 GMainContext *context;
18316 GMutex lock;
18317};
18318
18319static void
18320_event_log_skeleton_handle_method_call (
18321 GDBusConnection *connection G_GNUC_UNUSED,
18322 const gchar *sender G_GNUC_UNUSED,
18323 const gchar *object_path G_GNUC_UNUSED,
18324 const gchar *interface_name,
18325 const gchar *method_name,
18326 GVariant *parameters,
18327 GDBusMethodInvocation *invocation,
18328 gpointer user_data)
18329{
18330 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18331 _ExtendedGDBusMethodInfo *info;
18332 GVariantIter iter;
18333 GVariant *child;
18334 GValue *paramv;
18335 guint num_params;
18336 guint num_extra;
18337 guint n;
18338 guint signal_id;
18339 GValue return_value = G_VALUE_INIT;
18340 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18341 g_assert (info != NULL);
18342 num_params = g_variant_n_children (parameters);
18343 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18344 n = 0;
18345 g_value_init (&paramv[n], TYPE_EVENT_LOG);
18346 g_value_set_object (&paramv[n++], skeleton);
18347 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18348 g_value_set_object (&paramv[n++], invocation);
18349 if (info->pass_fdlist)
18350 {
18351#ifdef G_OS_UNIX
18352 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18353 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18354#else
18355 g_assert_not_reached ();
18356#endif
18357 }
18358 g_variant_iter_init (&iter, parameters);
18359 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18360 {
18361 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18362 if (arg_info->use_gvariant)
18363 {
18364 g_value_init (&paramv[n], G_TYPE_VARIANT);
18365 g_value_set_variant (&paramv[n], child);
18366 n++;
18367 }
18368 else
18369 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18370 g_variant_unref (child);
18371 }
18372 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18373 g_value_init (&return_value, G_TYPE_BOOLEAN);
18374 g_signal_emitv (paramv, signal_id, 0, &return_value);
18375 if (!g_value_get_boolean (&return_value))
18376 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);
18377 g_value_unset (&return_value);
18378 for (n = 0; n < num_params + num_extra; n++)
18379 g_value_unset (&paramv[n]);
18380 g_free (paramv);
18381}
18382
18383static GVariant *
18384_event_log_skeleton_handle_get_property (
18385 GDBusConnection *connection G_GNUC_UNUSED,
18386 const gchar *sender G_GNUC_UNUSED,
18387 const gchar *object_path G_GNUC_UNUSED,
18388 const gchar *interface_name G_GNUC_UNUSED,
18389 const gchar *property_name,
18390 GError **error,
18391 gpointer user_data)
18392{
18393 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18394 GValue value = G_VALUE_INIT;
18395 GParamSpec *pspec;
18396 _ExtendedGDBusPropertyInfo *info;
18397 GVariant *ret;
18398 ret = NULL;
18399 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18400 g_assert (info != NULL);
18401 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18402 if (pspec == NULL)
18403 {
18404 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18405 }
18406 else
18407 {
18408 g_value_init (&value, pspec->value_type);
18409 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18410 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18411 g_value_unset (&value);
18412 }
18413 return ret;
18414}
18415
18416static gboolean
18417_event_log_skeleton_handle_set_property (
18418 GDBusConnection *connection G_GNUC_UNUSED,
18419 const gchar *sender G_GNUC_UNUSED,
18420 const gchar *object_path G_GNUC_UNUSED,
18421 const gchar *interface_name G_GNUC_UNUSED,
18422 const gchar *property_name,
18423 GVariant *variant,
18424 GError **error,
18425 gpointer user_data)
18426{
18427 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18428 GValue value = G_VALUE_INIT;
18429 GParamSpec *pspec;
18430 _ExtendedGDBusPropertyInfo *info;
18431 gboolean ret;
18432 ret = FALSE;
18433 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18434 g_assert (info != NULL);
18435 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18436 if (pspec == NULL)
18437 {
18438 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18439 }
18440 else
18441 {
18442 if (info->use_gvariant)
18443 g_value_set_variant (&value, variant);
18444 else
18445 g_dbus_gvariant_to_gvalue (variant, &value);
18446 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18447 g_value_unset (&value);
18448 ret = TRUE;
18449 }
18450 return ret;
18451}
18452
18453static const GDBusInterfaceVTable _event_log_skeleton_vtable =
18454{
18455 _event_log_skeleton_handle_method_call,
18456 _event_log_skeleton_handle_get_property,
18457 _event_log_skeleton_handle_set_property,
18458 {NULL}
18459};
18460
18461static GDBusInterfaceInfo *
18462event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18463{
18464 return event_log_interface_info ();
18465}
18466
18467static GDBusInterfaceVTable *
18468event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18469{
18470 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
18471}
18472
18473static GVariant *
18474event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18475{
18476 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
18477
18478 GVariantBuilder builder;
18479 guint n;
18480 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18481 if (_event_log_interface_info.parent_struct.properties == NULL)
18482 goto out;
18483 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
18484 {
18485 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
18486 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18487 {
18488 GVariant *value;
18489 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);
18490 if (value != NULL)
18491 {
18492 g_variant_take_ref (value);
18493 g_variant_builder_add (&builder, "{sv}", info->name, value);
18494 g_variant_unref (value);
18495 }
18496 }
18497 }
18498out:
18499 return g_variant_builder_end (&builder);
18500}
18501
Norman James362a80f2015-09-14 14:04:39 -050018502static void
18503event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18504{
Norman James362a80f2015-09-14 14:04:39 -050018505}
18506
18507static void
18508_event_log_on_signal_event_log (
18509 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050018510 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050018511 const gchar *arg_message,
18512 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050018513{
18514 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18515
18516 GList *connections, *l;
18517 GVariant *signal_variant;
18518 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18519
Norman James88872672015-09-21 16:51:35 -050018520 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050018521 arg_priority,
Norman James88872672015-09-21 16:51:35 -050018522 arg_message,
18523 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050018524 for (l = connections; l != NULL; l = l->next)
18525 {
18526 GDBusConnection *connection = l->data;
18527 g_dbus_connection_emit_signal (connection,
18528 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
18529 signal_variant, NULL);
18530 }
18531 g_variant_unref (signal_variant);
18532 g_list_free_full (connections, g_object_unref);
18533}
18534
18535static void event_log_skeleton_iface_init (EventLogIface *iface);
18536#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18537G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18538 G_ADD_PRIVATE (EventLogSkeleton)
18539 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18540
18541#else
18542G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18543 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18544
18545#endif
18546static void
18547event_log_skeleton_finalize (GObject *object)
18548{
18549 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050018550 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18551 if (skeleton->priv->changed_properties_idle_source != NULL)
18552 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18553 g_main_context_unref (skeleton->priv->context);
18554 g_mutex_clear (&skeleton->priv->lock);
18555 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
18556}
18557
18558static void
Norman James362a80f2015-09-14 14:04:39 -050018559event_log_skeleton_init (EventLogSkeleton *skeleton)
18560{
18561#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18562 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
18563#else
18564 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
18565#endif
18566
18567 g_mutex_init (&skeleton->priv->lock);
18568 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050018569}
18570
18571static void
18572event_log_skeleton_class_init (EventLogSkeletonClass *klass)
18573{
18574 GObjectClass *gobject_class;
18575 GDBusInterfaceSkeletonClass *skeleton_class;
18576
18577 gobject_class = G_OBJECT_CLASS (klass);
18578 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050018579
18580 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18581 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
18582 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
18583 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
18584 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
18585
18586#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18587 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
18588#endif
18589}
18590
18591static void
18592event_log_skeleton_iface_init (EventLogIface *iface)
18593{
18594 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050018595}
18596
18597/**
18598 * event_log_skeleton_new:
18599 *
18600 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18601 *
18602 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
18603 */
18604EventLog *
18605event_log_skeleton_new (void)
18606{
18607 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
18608}
18609
18610/* ------------------------------------------------------------------------
18611 * Code for interface org.openbmc.Flash
18612 * ------------------------------------------------------------------------
18613 */
18614
18615/**
18616 * SECTION:Flash
18617 * @title: Flash
18618 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
18619 *
18620 * 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.
18621 */
18622
18623/* ---- Introspection data for org.openbmc.Flash ---- */
18624
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018625static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050018626{
18627 {
18628 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018629 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050018630 (gchar *) "s",
18631 NULL
18632 },
18633 FALSE
18634};
18635
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018636static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050018637{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018638 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050018639 NULL
18640};
18641
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018642static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050018643{
18644 {
18645 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018646 (gchar *) "update",
18647 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050018648 NULL,
18649 NULL
18650 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018651 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050018652 FALSE
18653};
18654
18655static const _ExtendedGDBusMethodInfo _flash_method_info_init =
18656{
18657 {
18658 -1,
18659 (gchar *) "init",
18660 NULL,
18661 NULL,
18662 NULL
18663 },
18664 "handle-init",
18665 FALSE
18666};
18667
18668static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
18669{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018670 &_flash_method_info_update,
Norman James362a80f2015-09-14 14:04:39 -050018671 &_flash_method_info_init,
18672 NULL
18673};
18674
18675static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
18676{
18677 {
18678 -1,
18679 (gchar *) "Updated",
18680 NULL,
18681 NULL
18682 },
18683 "updated"
18684};
18685
18686static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
18687{
18688 &_flash_signal_info_updated,
18689 NULL
18690};
18691
18692static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
18693{
18694 {
18695 -1,
18696 (gchar *) "org.openbmc.Flash",
18697 (GDBusMethodInfo **) &_flash_method_info_pointers,
18698 (GDBusSignalInfo **) &_flash_signal_info_pointers,
18699 NULL,
18700 NULL
18701 },
18702 "flash",
18703};
18704
18705
18706/**
18707 * flash_interface_info:
18708 *
18709 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
18710 *
18711 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18712 */
18713GDBusInterfaceInfo *
18714flash_interface_info (void)
18715{
18716 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
18717}
18718
18719/**
18720 * flash_override_properties:
18721 * @klass: The class structure for a #GObject<!-- -->-derived class.
18722 * @property_id_begin: The property id to assign to the first overridden property.
18723 *
18724 * Overrides all #GObject properties in the #Flash interface for a concrete class.
18725 * The properties are overridden in the order they are defined.
18726 *
18727 * Returns: The last property id.
18728 */
18729guint
18730flash_override_properties (GObjectClass *klass, guint property_id_begin)
18731{
18732 return property_id_begin - 1;
18733}
18734
18735
18736
18737/**
18738 * Flash:
18739 *
18740 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18741 */
18742
18743/**
18744 * FlashIface:
18745 * @parent_iface: The parent interface.
Norman James362a80f2015-09-14 14:04:39 -050018746 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018747 * @handle_update: Handler for the #Flash::handle-update signal.
Norman James362a80f2015-09-14 14:04:39 -050018748 * @updated: Handler for the #Flash::updated signal.
18749 *
18750 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18751 */
18752
18753typedef FlashIface FlashInterface;
18754G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
18755
18756static void
18757flash_default_init (FlashIface *iface)
18758{
18759 /* GObject signals for incoming D-Bus method calls: */
18760 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018761 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050018762 * @object: A #Flash.
18763 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018764 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050018765 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018766 * 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 -050018767 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018768 * 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 -050018769 *
18770 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18771 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018772 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050018773 G_TYPE_FROM_INTERFACE (iface),
18774 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018775 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050018776 g_signal_accumulator_true_handled,
18777 NULL,
18778 g_cclosure_marshal_generic,
18779 G_TYPE_BOOLEAN,
18780 2,
18781 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
18782
18783 /**
Norman James362a80f2015-09-14 14:04:39 -050018784 * Flash::handle-init:
18785 * @object: A #Flash.
18786 * @invocation: A #GDBusMethodInvocation.
18787 *
18788 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
18789 *
18790 * 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.
18791 *
18792 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18793 */
18794 g_signal_new ("handle-init",
18795 G_TYPE_FROM_INTERFACE (iface),
18796 G_SIGNAL_RUN_LAST,
18797 G_STRUCT_OFFSET (FlashIface, handle_init),
18798 g_signal_accumulator_true_handled,
18799 NULL,
18800 g_cclosure_marshal_generic,
18801 G_TYPE_BOOLEAN,
18802 1,
18803 G_TYPE_DBUS_METHOD_INVOCATION);
18804
18805 /* GObject signals for received D-Bus signals: */
18806 /**
18807 * Flash::updated:
18808 * @object: A #Flash.
18809 *
18810 * 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.
18811 *
18812 * 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.
18813 */
18814 g_signal_new ("updated",
18815 G_TYPE_FROM_INTERFACE (iface),
18816 G_SIGNAL_RUN_LAST,
18817 G_STRUCT_OFFSET (FlashIface, updated),
18818 NULL,
18819 NULL,
18820 g_cclosure_marshal_generic,
18821 G_TYPE_NONE,
18822 0);
18823
18824}
18825
18826/**
18827 * flash_emit_updated:
18828 * @object: A #Flash.
18829 *
18830 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
18831 */
18832void
18833flash_emit_updated (
18834 Flash *object)
18835{
18836 g_signal_emit_by_name (object, "updated");
18837}
18838
18839/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018840 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050018841 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018842 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050018843 * @cancellable: (allow-none): A #GCancellable or %NULL.
18844 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18845 * @user_data: User data to pass to @callback.
18846 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018847 * 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 -050018848 * When the operation is finished, @callback will be invoked 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 -050018849 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050018850 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018851 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050018852 */
18853void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018854flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050018855 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018856 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050018857 GCancellable *cancellable,
18858 GAsyncReadyCallback callback,
18859 gpointer user_data)
18860{
18861 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018862 "update",
Norman James362a80f2015-09-14 14:04:39 -050018863 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018864 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050018865 G_DBUS_CALL_FLAGS_NONE,
18866 -1,
18867 cancellable,
18868 callback,
18869 user_data);
18870}
18871
18872/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018873 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050018874 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018875 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050018876 * @error: Return location for error or %NULL.
18877 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018878 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050018879 *
18880 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18881 */
18882gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018883flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050018884 Flash *proxy,
18885 GAsyncResult *res,
18886 GError **error)
18887{
18888 GVariant *_ret;
18889 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18890 if (_ret == NULL)
18891 goto _out;
18892 g_variant_get (_ret,
18893 "()");
18894 g_variant_unref (_ret);
18895_out:
18896 return _ret != NULL;
18897}
18898
18899/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018900 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050018901 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018902 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050018903 * @cancellable: (allow-none): A #GCancellable or %NULL.
18904 * @error: Return location for error or %NULL.
18905 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018906 * 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 -050018907 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018908 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050018909 *
18910 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18911 */
18912gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018913flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050018914 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018915 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050018916 GCancellable *cancellable,
18917 GError **error)
18918{
18919 GVariant *_ret;
18920 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018921 "update",
Norman James362a80f2015-09-14 14:04:39 -050018922 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018923 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050018924 G_DBUS_CALL_FLAGS_NONE,
18925 -1,
18926 cancellable,
18927 error);
18928 if (_ret == NULL)
18929 goto _out;
18930 g_variant_get (_ret,
18931 "()");
18932 g_variant_unref (_ret);
18933_out:
18934 return _ret != NULL;
18935}
18936
18937/**
18938 * flash_call_init:
18939 * @proxy: A #FlashProxy.
18940 * @cancellable: (allow-none): A #GCancellable or %NULL.
18941 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18942 * @user_data: User data to pass to @callback.
18943 *
18944 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
18945 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18946 * You can then call flash_call_init_finish() to get the result of the operation.
18947 *
18948 * See flash_call_init_sync() for the synchronous, blocking version of this method.
18949 */
18950void
18951flash_call_init (
18952 Flash *proxy,
18953 GCancellable *cancellable,
18954 GAsyncReadyCallback callback,
18955 gpointer user_data)
18956{
18957 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18958 "init",
18959 g_variant_new ("()"),
18960 G_DBUS_CALL_FLAGS_NONE,
18961 -1,
18962 cancellable,
18963 callback,
18964 user_data);
18965}
18966
18967/**
18968 * flash_call_init_finish:
18969 * @proxy: A #FlashProxy.
18970 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
18971 * @error: Return location for error or %NULL.
18972 *
18973 * Finishes an operation started with flash_call_init().
18974 *
18975 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18976 */
18977gboolean
18978flash_call_init_finish (
18979 Flash *proxy,
18980 GAsyncResult *res,
18981 GError **error)
18982{
18983 GVariant *_ret;
18984 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18985 if (_ret == NULL)
18986 goto _out;
18987 g_variant_get (_ret,
18988 "()");
18989 g_variant_unref (_ret);
18990_out:
18991 return _ret != NULL;
18992}
18993
18994/**
18995 * flash_call_init_sync:
18996 * @proxy: A #FlashProxy.
18997 * @cancellable: (allow-none): A #GCancellable or %NULL.
18998 * @error: Return location for error or %NULL.
18999 *
19000 * 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.
19001 *
19002 * See flash_call_init() for the asynchronous version of this method.
19003 *
19004 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19005 */
19006gboolean
19007flash_call_init_sync (
19008 Flash *proxy,
19009 GCancellable *cancellable,
19010 GError **error)
19011{
19012 GVariant *_ret;
19013 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19014 "init",
19015 g_variant_new ("()"),
19016 G_DBUS_CALL_FLAGS_NONE,
19017 -1,
19018 cancellable,
19019 error);
19020 if (_ret == NULL)
19021 goto _out;
19022 g_variant_get (_ret,
19023 "()");
19024 g_variant_unref (_ret);
19025_out:
19026 return _ret != NULL;
19027}
19028
19029/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019030 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050019031 * @object: A #Flash.
19032 * @invocation: (transfer full): A #GDBusMethodInvocation.
19033 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019034 * 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 -050019035 *
19036 * This method will free @invocation, you cannot use it afterwards.
19037 */
19038void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019039flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050019040 Flash *object,
19041 GDBusMethodInvocation *invocation)
19042{
19043 g_dbus_method_invocation_return_value (invocation,
19044 g_variant_new ("()"));
19045}
19046
19047/**
19048 * flash_complete_init:
19049 * @object: A #Flash.
19050 * @invocation: (transfer full): A #GDBusMethodInvocation.
19051 *
19052 * 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.
19053 *
19054 * This method will free @invocation, you cannot use it afterwards.
19055 */
19056void
19057flash_complete_init (
19058 Flash *object,
19059 GDBusMethodInvocation *invocation)
19060{
19061 g_dbus_method_invocation_return_value (invocation,
19062 g_variant_new ("()"));
19063}
19064
19065/* ------------------------------------------------------------------------ */
19066
19067/**
19068 * FlashProxy:
19069 *
19070 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
19071 */
19072
19073/**
19074 * FlashProxyClass:
19075 * @parent_class: The parent class.
19076 *
19077 * Class structure for #FlashProxy.
19078 */
19079
19080struct _FlashProxyPrivate
19081{
19082 GData *qdata;
19083};
19084
19085static void flash_proxy_iface_init (FlashIface *iface);
19086
19087#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19088G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19089 G_ADD_PRIVATE (FlashProxy)
19090 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19091
19092#else
19093G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19094 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19095
19096#endif
19097static void
19098flash_proxy_finalize (GObject *object)
19099{
19100 FlashProxy *proxy = FLASH_PROXY (object);
19101 g_datalist_clear (&proxy->priv->qdata);
19102 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
19103}
19104
19105static void
19106flash_proxy_get_property (GObject *object,
19107 guint prop_id,
19108 GValue *value,
19109 GParamSpec *pspec G_GNUC_UNUSED)
19110{
19111}
19112
19113static void
19114flash_proxy_set_property (GObject *object,
19115 guint prop_id,
19116 const GValue *value,
19117 GParamSpec *pspec G_GNUC_UNUSED)
19118{
19119}
19120
19121static void
19122flash_proxy_g_signal (GDBusProxy *proxy,
19123 const gchar *sender_name G_GNUC_UNUSED,
19124 const gchar *signal_name,
19125 GVariant *parameters)
19126{
19127 _ExtendedGDBusSignalInfo *info;
19128 GVariantIter iter;
19129 GVariant *child;
19130 GValue *paramv;
19131 guint num_params;
19132 guint n;
19133 guint signal_id;
19134 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
19135 if (info == NULL)
19136 return;
19137 num_params = g_variant_n_children (parameters);
19138 paramv = g_new0 (GValue, num_params + 1);
19139 g_value_init (&paramv[0], TYPE_FLASH);
19140 g_value_set_object (&paramv[0], proxy);
19141 g_variant_iter_init (&iter, parameters);
19142 n = 1;
19143 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19144 {
19145 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19146 if (arg_info->use_gvariant)
19147 {
19148 g_value_init (&paramv[n], G_TYPE_VARIANT);
19149 g_value_set_variant (&paramv[n], child);
19150 n++;
19151 }
19152 else
19153 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19154 g_variant_unref (child);
19155 }
19156 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19157 g_signal_emitv (paramv, signal_id, 0, NULL);
19158 for (n = 0; n < num_params + 1; n++)
19159 g_value_unset (&paramv[n]);
19160 g_free (paramv);
19161}
19162
19163static void
19164flash_proxy_g_properties_changed (GDBusProxy *_proxy,
19165 GVariant *changed_properties,
19166 const gchar *const *invalidated_properties)
19167{
19168 FlashProxy *proxy = FLASH_PROXY (_proxy);
19169 guint n;
19170 const gchar *key;
19171 GVariantIter *iter;
19172 _ExtendedGDBusPropertyInfo *info;
19173 g_variant_get (changed_properties, "a{sv}", &iter);
19174 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19175 {
19176 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
19177 g_datalist_remove_data (&proxy->priv->qdata, key);
19178 if (info != NULL)
19179 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19180 }
19181 g_variant_iter_free (iter);
19182 for (n = 0; invalidated_properties[n] != NULL; n++)
19183 {
19184 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
19185 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19186 if (info != NULL)
19187 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19188 }
19189}
19190
19191static void
19192flash_proxy_init (FlashProxy *proxy)
19193{
19194#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19195 proxy->priv = flash_proxy_get_instance_private (proxy);
19196#else
19197 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
19198#endif
19199
19200 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
19201}
19202
19203static void
19204flash_proxy_class_init (FlashProxyClass *klass)
19205{
19206 GObjectClass *gobject_class;
19207 GDBusProxyClass *proxy_class;
19208
19209 gobject_class = G_OBJECT_CLASS (klass);
19210 gobject_class->finalize = flash_proxy_finalize;
19211 gobject_class->get_property = flash_proxy_get_property;
19212 gobject_class->set_property = flash_proxy_set_property;
19213
19214 proxy_class = G_DBUS_PROXY_CLASS (klass);
19215 proxy_class->g_signal = flash_proxy_g_signal;
19216 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
19217
19218#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19219 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
19220#endif
19221}
19222
19223static void
19224flash_proxy_iface_init (FlashIface *iface)
19225{
19226}
19227
19228/**
19229 * flash_proxy_new:
19230 * @connection: A #GDBusConnection.
19231 * @flags: Flags from the #GDBusProxyFlags enumeration.
19232 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19233 * @object_path: An object path.
19234 * @cancellable: (allow-none): A #GCancellable or %NULL.
19235 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19236 * @user_data: User data to pass to @callback.
19237 *
19238 * 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.
19239 *
19240 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19241 * You can then call flash_proxy_new_finish() to get the result of the operation.
19242 *
19243 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
19244 */
19245void
19246flash_proxy_new (
19247 GDBusConnection *connection,
19248 GDBusProxyFlags flags,
19249 const gchar *name,
19250 const gchar *object_path,
19251 GCancellable *cancellable,
19252 GAsyncReadyCallback callback,
19253 gpointer user_data)
19254{
19255 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);
19256}
19257
19258/**
19259 * flash_proxy_new_finish:
19260 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
19261 * @error: Return location for error or %NULL
19262 *
19263 * Finishes an operation started with flash_proxy_new().
19264 *
19265 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19266 */
19267Flash *
19268flash_proxy_new_finish (
19269 GAsyncResult *res,
19270 GError **error)
19271{
19272 GObject *ret;
19273 GObject *source_object;
19274 source_object = g_async_result_get_source_object (res);
19275 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19276 g_object_unref (source_object);
19277 if (ret != NULL)
19278 return FLASH (ret);
19279 else
19280 return NULL;
19281}
19282
19283/**
19284 * flash_proxy_new_sync:
19285 * @connection: A #GDBusConnection.
19286 * @flags: Flags from the #GDBusProxyFlags enumeration.
19287 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19288 * @object_path: An object path.
19289 * @cancellable: (allow-none): A #GCancellable or %NULL.
19290 * @error: Return location for error or %NULL
19291 *
19292 * 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.
19293 *
19294 * The calling thread is blocked until a reply is received.
19295 *
19296 * See flash_proxy_new() for the asynchronous version of this constructor.
19297 *
19298 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19299 */
19300Flash *
19301flash_proxy_new_sync (
19302 GDBusConnection *connection,
19303 GDBusProxyFlags flags,
19304 const gchar *name,
19305 const gchar *object_path,
19306 GCancellable *cancellable,
19307 GError **error)
19308{
19309 GInitable *ret;
19310 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);
19311 if (ret != NULL)
19312 return FLASH (ret);
19313 else
19314 return NULL;
19315}
19316
19317
19318/**
19319 * flash_proxy_new_for_bus:
19320 * @bus_type: A #GBusType.
19321 * @flags: Flags from the #GDBusProxyFlags enumeration.
19322 * @name: A bus name (well-known or unique).
19323 * @object_path: An object path.
19324 * @cancellable: (allow-none): A #GCancellable or %NULL.
19325 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19326 * @user_data: User data to pass to @callback.
19327 *
19328 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19329 *
19330 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19331 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
19332 *
19333 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19334 */
19335void
19336flash_proxy_new_for_bus (
19337 GBusType bus_type,
19338 GDBusProxyFlags flags,
19339 const gchar *name,
19340 const gchar *object_path,
19341 GCancellable *cancellable,
19342 GAsyncReadyCallback callback,
19343 gpointer user_data)
19344{
19345 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);
19346}
19347
19348/**
19349 * flash_proxy_new_for_bus_finish:
19350 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
19351 * @error: Return location for error or %NULL
19352 *
19353 * Finishes an operation started with flash_proxy_new_for_bus().
19354 *
19355 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19356 */
19357Flash *
19358flash_proxy_new_for_bus_finish (
19359 GAsyncResult *res,
19360 GError **error)
19361{
19362 GObject *ret;
19363 GObject *source_object;
19364 source_object = g_async_result_get_source_object (res);
19365 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19366 g_object_unref (source_object);
19367 if (ret != NULL)
19368 return FLASH (ret);
19369 else
19370 return NULL;
19371}
19372
19373/**
19374 * flash_proxy_new_for_bus_sync:
19375 * @bus_type: A #GBusType.
19376 * @flags: Flags from the #GDBusProxyFlags enumeration.
19377 * @name: A bus name (well-known or unique).
19378 * @object_path: An object path.
19379 * @cancellable: (allow-none): A #GCancellable or %NULL.
19380 * @error: Return location for error or %NULL
19381 *
19382 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19383 *
19384 * The calling thread is blocked until a reply is received.
19385 *
19386 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
19387 *
19388 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19389 */
19390Flash *
19391flash_proxy_new_for_bus_sync (
19392 GBusType bus_type,
19393 GDBusProxyFlags flags,
19394 const gchar *name,
19395 const gchar *object_path,
19396 GCancellable *cancellable,
19397 GError **error)
19398{
19399 GInitable *ret;
19400 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);
19401 if (ret != NULL)
19402 return FLASH (ret);
19403 else
19404 return NULL;
19405}
19406
19407
19408/* ------------------------------------------------------------------------ */
19409
19410/**
19411 * FlashSkeleton:
19412 *
19413 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
19414 */
19415
19416/**
19417 * FlashSkeletonClass:
19418 * @parent_class: The parent class.
19419 *
19420 * Class structure for #FlashSkeleton.
19421 */
19422
19423struct _FlashSkeletonPrivate
19424{
19425 GValue *properties;
19426 GList *changed_properties;
19427 GSource *changed_properties_idle_source;
19428 GMainContext *context;
19429 GMutex lock;
19430};
19431
19432static void
19433_flash_skeleton_handle_method_call (
19434 GDBusConnection *connection G_GNUC_UNUSED,
19435 const gchar *sender G_GNUC_UNUSED,
19436 const gchar *object_path G_GNUC_UNUSED,
19437 const gchar *interface_name,
19438 const gchar *method_name,
19439 GVariant *parameters,
19440 GDBusMethodInvocation *invocation,
19441 gpointer user_data)
19442{
19443 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19444 _ExtendedGDBusMethodInfo *info;
19445 GVariantIter iter;
19446 GVariant *child;
19447 GValue *paramv;
19448 guint num_params;
19449 guint num_extra;
19450 guint n;
19451 guint signal_id;
19452 GValue return_value = G_VALUE_INIT;
19453 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19454 g_assert (info != NULL);
19455 num_params = g_variant_n_children (parameters);
19456 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19457 n = 0;
19458 g_value_init (&paramv[n], TYPE_FLASH);
19459 g_value_set_object (&paramv[n++], skeleton);
19460 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19461 g_value_set_object (&paramv[n++], invocation);
19462 if (info->pass_fdlist)
19463 {
19464#ifdef G_OS_UNIX
19465 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19466 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19467#else
19468 g_assert_not_reached ();
19469#endif
19470 }
19471 g_variant_iter_init (&iter, parameters);
19472 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19473 {
19474 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19475 if (arg_info->use_gvariant)
19476 {
19477 g_value_init (&paramv[n], G_TYPE_VARIANT);
19478 g_value_set_variant (&paramv[n], child);
19479 n++;
19480 }
19481 else
19482 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19483 g_variant_unref (child);
19484 }
19485 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19486 g_value_init (&return_value, G_TYPE_BOOLEAN);
19487 g_signal_emitv (paramv, signal_id, 0, &return_value);
19488 if (!g_value_get_boolean (&return_value))
19489 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);
19490 g_value_unset (&return_value);
19491 for (n = 0; n < num_params + num_extra; n++)
19492 g_value_unset (&paramv[n]);
19493 g_free (paramv);
19494}
19495
19496static GVariant *
19497_flash_skeleton_handle_get_property (
19498 GDBusConnection *connection G_GNUC_UNUSED,
19499 const gchar *sender G_GNUC_UNUSED,
19500 const gchar *object_path G_GNUC_UNUSED,
19501 const gchar *interface_name G_GNUC_UNUSED,
19502 const gchar *property_name,
19503 GError **error,
19504 gpointer user_data)
19505{
19506 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19507 GValue value = G_VALUE_INIT;
19508 GParamSpec *pspec;
19509 _ExtendedGDBusPropertyInfo *info;
19510 GVariant *ret;
19511 ret = NULL;
19512 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
19513 g_assert (info != NULL);
19514 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19515 if (pspec == NULL)
19516 {
19517 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19518 }
19519 else
19520 {
19521 g_value_init (&value, pspec->value_type);
19522 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19523 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19524 g_value_unset (&value);
19525 }
19526 return ret;
19527}
19528
19529static gboolean
19530_flash_skeleton_handle_set_property (
19531 GDBusConnection *connection G_GNUC_UNUSED,
19532 const gchar *sender G_GNUC_UNUSED,
19533 const gchar *object_path G_GNUC_UNUSED,
19534 const gchar *interface_name G_GNUC_UNUSED,
19535 const gchar *property_name,
19536 GVariant *variant,
19537 GError **error,
19538 gpointer user_data)
19539{
19540 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19541 GValue value = G_VALUE_INIT;
19542 GParamSpec *pspec;
19543 _ExtendedGDBusPropertyInfo *info;
19544 gboolean ret;
19545 ret = FALSE;
19546 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
19547 g_assert (info != NULL);
19548 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19549 if (pspec == NULL)
19550 {
19551 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19552 }
19553 else
19554 {
19555 if (info->use_gvariant)
19556 g_value_set_variant (&value, variant);
19557 else
19558 g_dbus_gvariant_to_gvalue (variant, &value);
19559 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19560 g_value_unset (&value);
19561 ret = TRUE;
19562 }
19563 return ret;
19564}
19565
19566static const GDBusInterfaceVTable _flash_skeleton_vtable =
19567{
19568 _flash_skeleton_handle_method_call,
19569 _flash_skeleton_handle_get_property,
19570 _flash_skeleton_handle_set_property,
19571 {NULL}
19572};
19573
19574static GDBusInterfaceInfo *
19575flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19576{
19577 return flash_interface_info ();
19578}
19579
19580static GDBusInterfaceVTable *
19581flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19582{
19583 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
19584}
19585
19586static GVariant *
19587flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19588{
19589 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
19590
19591 GVariantBuilder builder;
19592 guint n;
19593 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19594 if (_flash_interface_info.parent_struct.properties == NULL)
19595 goto out;
19596 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
19597 {
19598 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
19599 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19600 {
19601 GVariant *value;
19602 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);
19603 if (value != NULL)
19604 {
19605 g_variant_take_ref (value);
19606 g_variant_builder_add (&builder, "{sv}", info->name, value);
19607 g_variant_unref (value);
19608 }
19609 }
19610 }
19611out:
19612 return g_variant_builder_end (&builder);
19613}
19614
19615static void
19616flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
19617{
19618}
19619
19620static void
19621_flash_on_signal_updated (
19622 Flash *object)
19623{
19624 FlashSkeleton *skeleton = FLASH_SKELETON (object);
19625
19626 GList *connections, *l;
19627 GVariant *signal_variant;
19628 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19629
19630 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
19631 for (l = connections; l != NULL; l = l->next)
19632 {
19633 GDBusConnection *connection = l->data;
19634 g_dbus_connection_emit_signal (connection,
19635 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
19636 signal_variant, NULL);
19637 }
19638 g_variant_unref (signal_variant);
19639 g_list_free_full (connections, g_object_unref);
19640}
19641
19642static void flash_skeleton_iface_init (FlashIface *iface);
19643#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19644G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19645 G_ADD_PRIVATE (FlashSkeleton)
19646 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
19647
19648#else
19649G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19650 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
19651
19652#endif
19653static void
19654flash_skeleton_finalize (GObject *object)
19655{
19656 FlashSkeleton *skeleton = FLASH_SKELETON (object);
19657 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19658 if (skeleton->priv->changed_properties_idle_source != NULL)
19659 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19660 g_main_context_unref (skeleton->priv->context);
19661 g_mutex_clear (&skeleton->priv->lock);
19662 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
19663}
19664
19665static void
19666flash_skeleton_init (FlashSkeleton *skeleton)
19667{
19668#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19669 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
19670#else
19671 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
19672#endif
19673
19674 g_mutex_init (&skeleton->priv->lock);
19675 skeleton->priv->context = g_main_context_ref_thread_default ();
19676}
19677
19678static void
19679flash_skeleton_class_init (FlashSkeletonClass *klass)
19680{
19681 GObjectClass *gobject_class;
19682 GDBusInterfaceSkeletonClass *skeleton_class;
19683
19684 gobject_class = G_OBJECT_CLASS (klass);
19685 gobject_class->finalize = flash_skeleton_finalize;
19686
19687 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
19688 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
19689 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
19690 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
19691 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
19692
19693#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19694 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
19695#endif
19696}
19697
19698static void
19699flash_skeleton_iface_init (FlashIface *iface)
19700{
19701 iface->updated = _flash_on_signal_updated;
19702}
19703
19704/**
19705 * flash_skeleton_new:
19706 *
19707 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
19708 *
19709 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
19710 */
19711Flash *
19712flash_skeleton_new (void)
19713{
19714 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
19715}
19716
19717/* ------------------------------------------------------------------------
19718 * Code for interface org.openbmc.Button
19719 * ------------------------------------------------------------------------
19720 */
19721
19722/**
19723 * SECTION:Button
19724 * @title: Button
19725 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
19726 *
19727 * 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.
19728 */
19729
19730/* ---- Introspection data for org.openbmc.Button ---- */
19731
19732static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
19733{
19734 {
19735 -1,
19736 (gchar *) "state",
19737 (gchar *) "b",
19738 NULL
19739 },
19740 FALSE
19741};
19742
19743static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
19744{
19745 &_button_method_info_is_on_OUT_ARG_state,
19746 NULL
19747};
19748
19749static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
19750{
19751 {
19752 -1,
19753 (gchar *) "isOn",
19754 NULL,
19755 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
19756 NULL
19757 },
19758 "handle-is-on",
19759 FALSE
19760};
19761
19762static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
19763{
19764 {
19765 -1,
19766 (gchar *) "simButtonPress",
19767 NULL,
19768 NULL,
19769 NULL
19770 },
19771 "handle-sim-button-press",
19772 FALSE
19773};
19774
19775static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
19776{
19777 {
19778 -1,
19779 (gchar *) "simButtonLongPress",
19780 NULL,
19781 NULL,
19782 NULL
19783 },
19784 "handle-sim-button-long-press",
19785 FALSE
19786};
19787
19788static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
19789{
19790 &_button_method_info_is_on,
19791 &_button_method_info_sim_button_press,
19792 &_button_method_info_sim_button_long_press,
19793 NULL
19794};
19795
19796static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
19797{
19798 {
19799 -1,
19800 (gchar *) "ButtonRelease",
19801 NULL,
19802 NULL
19803 },
19804 "button-release"
19805};
19806
19807static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
19808{
19809 {
19810 -1,
19811 (gchar *) "ButtonPressed",
19812 NULL,
19813 NULL
19814 },
19815 "button-pressed"
19816};
19817
19818static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
19819{
19820 {
19821 -1,
19822 (gchar *) "ButtonPressedLong",
19823 NULL,
19824 NULL
19825 },
19826 "button-pressed-long"
19827};
19828
19829static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
19830{
19831 &_button_signal_info_button_release,
19832 &_button_signal_info_button_pressed,
19833 &_button_signal_info_button_pressed_long,
19834 NULL
19835};
19836
19837static const _ExtendedGDBusPropertyInfo _button_property_info_state =
19838{
19839 {
19840 -1,
19841 (gchar *) "state",
19842 (gchar *) "b",
19843 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19844 NULL
19845 },
19846 "state",
19847 FALSE
19848};
19849
19850static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
19851{
19852 &_button_property_info_state,
19853 NULL
19854};
19855
19856static const _ExtendedGDBusInterfaceInfo _button_interface_info =
19857{
19858 {
19859 -1,
19860 (gchar *) "org.openbmc.Button",
19861 (GDBusMethodInfo **) &_button_method_info_pointers,
19862 (GDBusSignalInfo **) &_button_signal_info_pointers,
19863 (GDBusPropertyInfo **) &_button_property_info_pointers,
19864 NULL
19865 },
19866 "button",
19867};
19868
19869
19870/**
19871 * button_interface_info:
19872 *
19873 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
19874 *
19875 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19876 */
19877GDBusInterfaceInfo *
19878button_interface_info (void)
19879{
19880 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
19881}
19882
19883/**
19884 * button_override_properties:
19885 * @klass: The class structure for a #GObject<!-- -->-derived class.
19886 * @property_id_begin: The property id to assign to the first overridden property.
19887 *
19888 * Overrides all #GObject properties in the #Button interface for a concrete class.
19889 * The properties are overridden in the order they are defined.
19890 *
19891 * Returns: The last property id.
19892 */
19893guint
19894button_override_properties (GObjectClass *klass, guint property_id_begin)
19895{
19896 g_object_class_override_property (klass, property_id_begin++, "state");
19897 return property_id_begin - 1;
19898}
19899
19900
19901
19902/**
19903 * Button:
19904 *
19905 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
19906 */
19907
19908/**
19909 * ButtonIface:
19910 * @parent_iface: The parent interface.
19911 * @handle_is_on: Handler for the #Button::handle-is-on signal.
19912 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
19913 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
19914 * @get_state: Getter for the #Button:state property.
19915 * @button_pressed: Handler for the #Button::button-pressed signal.
19916 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
19917 * @button_release: Handler for the #Button::button-release signal.
19918 *
19919 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
19920 */
19921
19922typedef ButtonIface ButtonInterface;
19923G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
19924
19925static void
19926button_default_init (ButtonIface *iface)
19927{
19928 /* GObject signals for incoming D-Bus method calls: */
19929 /**
19930 * Button::handle-is-on:
19931 * @object: A #Button.
19932 * @invocation: A #GDBusMethodInvocation.
19933 *
19934 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
19935 *
19936 * 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.
19937 *
19938 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19939 */
19940 g_signal_new ("handle-is-on",
19941 G_TYPE_FROM_INTERFACE (iface),
19942 G_SIGNAL_RUN_LAST,
19943 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
19944 g_signal_accumulator_true_handled,
19945 NULL,
19946 g_cclosure_marshal_generic,
19947 G_TYPE_BOOLEAN,
19948 1,
19949 G_TYPE_DBUS_METHOD_INVOCATION);
19950
19951 /**
19952 * Button::handle-sim-button-press:
19953 * @object: A #Button.
19954 * @invocation: A #GDBusMethodInvocation.
19955 *
19956 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
19957 *
19958 * 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.
19959 *
19960 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19961 */
19962 g_signal_new ("handle-sim-button-press",
19963 G_TYPE_FROM_INTERFACE (iface),
19964 G_SIGNAL_RUN_LAST,
19965 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
19966 g_signal_accumulator_true_handled,
19967 NULL,
19968 g_cclosure_marshal_generic,
19969 G_TYPE_BOOLEAN,
19970 1,
19971 G_TYPE_DBUS_METHOD_INVOCATION);
19972
19973 /**
19974 * Button::handle-sim-button-long-press:
19975 * @object: A #Button.
19976 * @invocation: A #GDBusMethodInvocation.
19977 *
19978 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
19979 *
19980 * 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.
19981 *
19982 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19983 */
19984 g_signal_new ("handle-sim-button-long-press",
19985 G_TYPE_FROM_INTERFACE (iface),
19986 G_SIGNAL_RUN_LAST,
19987 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
19988 g_signal_accumulator_true_handled,
19989 NULL,
19990 g_cclosure_marshal_generic,
19991 G_TYPE_BOOLEAN,
19992 1,
19993 G_TYPE_DBUS_METHOD_INVOCATION);
19994
19995 /* GObject signals for received D-Bus signals: */
19996 /**
19997 * Button::button-release:
19998 * @object: A #Button.
19999 *
20000 * 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.
20001 *
20002 * 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.
20003 */
20004 g_signal_new ("button-release",
20005 G_TYPE_FROM_INTERFACE (iface),
20006 G_SIGNAL_RUN_LAST,
20007 G_STRUCT_OFFSET (ButtonIface, button_release),
20008 NULL,
20009 NULL,
20010 g_cclosure_marshal_generic,
20011 G_TYPE_NONE,
20012 0);
20013
20014 /**
20015 * Button::button-pressed:
20016 * @object: A #Button.
20017 *
20018 * 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.
20019 *
20020 * 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.
20021 */
20022 g_signal_new ("button-pressed",
20023 G_TYPE_FROM_INTERFACE (iface),
20024 G_SIGNAL_RUN_LAST,
20025 G_STRUCT_OFFSET (ButtonIface, button_pressed),
20026 NULL,
20027 NULL,
20028 g_cclosure_marshal_generic,
20029 G_TYPE_NONE,
20030 0);
20031
20032 /**
20033 * Button::button-pressed-long:
20034 * @object: A #Button.
20035 *
20036 * 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.
20037 *
20038 * 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.
20039 */
20040 g_signal_new ("button-pressed-long",
20041 G_TYPE_FROM_INTERFACE (iface),
20042 G_SIGNAL_RUN_LAST,
20043 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
20044 NULL,
20045 NULL,
20046 g_cclosure_marshal_generic,
20047 G_TYPE_NONE,
20048 0);
20049
20050 /* GObject properties for D-Bus properties: */
20051 /**
20052 * Button:state:
20053 *
20054 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
20055 *
20056 * 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.
20057 */
20058 g_object_interface_install_property (iface,
20059 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20060}
20061
20062/**
20063 * button_get_state: (skip)
20064 * @object: A #Button.
20065 *
20066 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
20067 *
20068 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20069 *
20070 * Returns: The property value.
20071 */
20072gboolean
20073button_get_state (Button *object)
20074{
20075 return BUTTON_GET_IFACE (object)->get_state (object);
20076}
20077
20078/**
20079 * button_set_state: (skip)
20080 * @object: A #Button.
20081 * @value: The value to set.
20082 *
20083 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
20084 *
20085 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20086 */
20087void
20088button_set_state (Button *object, gboolean value)
20089{
20090 g_object_set (G_OBJECT (object), "state", value, NULL);
20091}
20092
20093/**
20094 * button_emit_button_release:
20095 * @object: A #Button.
20096 *
20097 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
20098 */
20099void
20100button_emit_button_release (
20101 Button *object)
20102{
20103 g_signal_emit_by_name (object, "button-release");
20104}
20105
20106/**
20107 * button_emit_button_pressed:
20108 * @object: A #Button.
20109 *
20110 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
20111 */
20112void
20113button_emit_button_pressed (
20114 Button *object)
20115{
20116 g_signal_emit_by_name (object, "button-pressed");
20117}
20118
20119/**
20120 * button_emit_button_pressed_long:
20121 * @object: A #Button.
20122 *
20123 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
20124 */
20125void
20126button_emit_button_pressed_long (
20127 Button *object)
20128{
20129 g_signal_emit_by_name (object, "button-pressed-long");
20130}
20131
20132/**
20133 * button_call_is_on:
20134 * @proxy: A #ButtonProxy.
20135 * @cancellable: (allow-none): A #GCancellable or %NULL.
20136 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20137 * @user_data: User data to pass to @callback.
20138 *
20139 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
20140 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20141 * You can then call button_call_is_on_finish() to get the result of the operation.
20142 *
20143 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
20144 */
20145void
20146button_call_is_on (
20147 Button *proxy,
20148 GCancellable *cancellable,
20149 GAsyncReadyCallback callback,
20150 gpointer user_data)
20151{
20152 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20153 "isOn",
20154 g_variant_new ("()"),
20155 G_DBUS_CALL_FLAGS_NONE,
20156 -1,
20157 cancellable,
20158 callback,
20159 user_data);
20160}
20161
20162/**
20163 * button_call_is_on_finish:
20164 * @proxy: A #ButtonProxy.
20165 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20166 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
20167 * @error: Return location for error or %NULL.
20168 *
20169 * Finishes an operation started with button_call_is_on().
20170 *
20171 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20172 */
20173gboolean
20174button_call_is_on_finish (
20175 Button *proxy,
20176 gboolean *out_state,
20177 GAsyncResult *res,
20178 GError **error)
20179{
20180 GVariant *_ret;
20181 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20182 if (_ret == NULL)
20183 goto _out;
20184 g_variant_get (_ret,
20185 "(b)",
20186 out_state);
20187 g_variant_unref (_ret);
20188_out:
20189 return _ret != NULL;
20190}
20191
20192/**
20193 * button_call_is_on_sync:
20194 * @proxy: A #ButtonProxy.
20195 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20196 * @cancellable: (allow-none): A #GCancellable or %NULL.
20197 * @error: Return location for error or %NULL.
20198 *
20199 * 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.
20200 *
20201 * See button_call_is_on() for the asynchronous version of this method.
20202 *
20203 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20204 */
20205gboolean
20206button_call_is_on_sync (
20207 Button *proxy,
20208 gboolean *out_state,
20209 GCancellable *cancellable,
20210 GError **error)
20211{
20212 GVariant *_ret;
20213 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20214 "isOn",
20215 g_variant_new ("()"),
20216 G_DBUS_CALL_FLAGS_NONE,
20217 -1,
20218 cancellable,
20219 error);
20220 if (_ret == NULL)
20221 goto _out;
20222 g_variant_get (_ret,
20223 "(b)",
20224 out_state);
20225 g_variant_unref (_ret);
20226_out:
20227 return _ret != NULL;
20228}
20229
20230/**
20231 * button_call_sim_button_press:
20232 * @proxy: A #ButtonProxy.
20233 * @cancellable: (allow-none): A #GCancellable or %NULL.
20234 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20235 * @user_data: User data to pass to @callback.
20236 *
20237 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
20238 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20239 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
20240 *
20241 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
20242 */
20243void
20244button_call_sim_button_press (
20245 Button *proxy,
20246 GCancellable *cancellable,
20247 GAsyncReadyCallback callback,
20248 gpointer user_data)
20249{
20250 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20251 "simButtonPress",
20252 g_variant_new ("()"),
20253 G_DBUS_CALL_FLAGS_NONE,
20254 -1,
20255 cancellable,
20256 callback,
20257 user_data);
20258}
20259
20260/**
20261 * button_call_sim_button_press_finish:
20262 * @proxy: A #ButtonProxy.
20263 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
20264 * @error: Return location for error or %NULL.
20265 *
20266 * Finishes an operation started with button_call_sim_button_press().
20267 *
20268 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20269 */
20270gboolean
20271button_call_sim_button_press_finish (
20272 Button *proxy,
20273 GAsyncResult *res,
20274 GError **error)
20275{
20276 GVariant *_ret;
20277 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20278 if (_ret == NULL)
20279 goto _out;
20280 g_variant_get (_ret,
20281 "()");
20282 g_variant_unref (_ret);
20283_out:
20284 return _ret != NULL;
20285}
20286
20287/**
20288 * button_call_sim_button_press_sync:
20289 * @proxy: A #ButtonProxy.
20290 * @cancellable: (allow-none): A #GCancellable or %NULL.
20291 * @error: Return location for error or %NULL.
20292 *
20293 * 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.
20294 *
20295 * See button_call_sim_button_press() for the asynchronous version of this method.
20296 *
20297 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20298 */
20299gboolean
20300button_call_sim_button_press_sync (
20301 Button *proxy,
20302 GCancellable *cancellable,
20303 GError **error)
20304{
20305 GVariant *_ret;
20306 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20307 "simButtonPress",
20308 g_variant_new ("()"),
20309 G_DBUS_CALL_FLAGS_NONE,
20310 -1,
20311 cancellable,
20312 error);
20313 if (_ret == NULL)
20314 goto _out;
20315 g_variant_get (_ret,
20316 "()");
20317 g_variant_unref (_ret);
20318_out:
20319 return _ret != NULL;
20320}
20321
20322/**
20323 * button_call_sim_button_long_press:
20324 * @proxy: A #ButtonProxy.
20325 * @cancellable: (allow-none): A #GCancellable or %NULL.
20326 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20327 * @user_data: User data to pass to @callback.
20328 *
20329 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
20330 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20331 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
20332 *
20333 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
20334 */
20335void
20336button_call_sim_button_long_press (
20337 Button *proxy,
20338 GCancellable *cancellable,
20339 GAsyncReadyCallback callback,
20340 gpointer user_data)
20341{
20342 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20343 "simButtonLongPress",
20344 g_variant_new ("()"),
20345 G_DBUS_CALL_FLAGS_NONE,
20346 -1,
20347 cancellable,
20348 callback,
20349 user_data);
20350}
20351
20352/**
20353 * button_call_sim_button_long_press_finish:
20354 * @proxy: A #ButtonProxy.
20355 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
20356 * @error: Return location for error or %NULL.
20357 *
20358 * Finishes an operation started with button_call_sim_button_long_press().
20359 *
20360 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20361 */
20362gboolean
20363button_call_sim_button_long_press_finish (
20364 Button *proxy,
20365 GAsyncResult *res,
20366 GError **error)
20367{
20368 GVariant *_ret;
20369 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20370 if (_ret == NULL)
20371 goto _out;
20372 g_variant_get (_ret,
20373 "()");
20374 g_variant_unref (_ret);
20375_out:
20376 return _ret != NULL;
20377}
20378
20379/**
20380 * button_call_sim_button_long_press_sync:
20381 * @proxy: A #ButtonProxy.
20382 * @cancellable: (allow-none): A #GCancellable or %NULL.
20383 * @error: Return location for error or %NULL.
20384 *
20385 * 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.
20386 *
20387 * See button_call_sim_button_long_press() for the asynchronous version of this method.
20388 *
20389 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20390 */
20391gboolean
20392button_call_sim_button_long_press_sync (
20393 Button *proxy,
20394 GCancellable *cancellable,
20395 GError **error)
20396{
20397 GVariant *_ret;
20398 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20399 "simButtonLongPress",
20400 g_variant_new ("()"),
20401 G_DBUS_CALL_FLAGS_NONE,
20402 -1,
20403 cancellable,
20404 error);
20405 if (_ret == NULL)
20406 goto _out;
20407 g_variant_get (_ret,
20408 "()");
20409 g_variant_unref (_ret);
20410_out:
20411 return _ret != NULL;
20412}
20413
20414/**
20415 * button_complete_is_on:
20416 * @object: A #Button.
20417 * @invocation: (transfer full): A #GDBusMethodInvocation.
20418 * @state: Parameter to return.
20419 *
20420 * 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.
20421 *
20422 * This method will free @invocation, you cannot use it afterwards.
20423 */
20424void
20425button_complete_is_on (
20426 Button *object,
20427 GDBusMethodInvocation *invocation,
20428 gboolean state)
20429{
20430 g_dbus_method_invocation_return_value (invocation,
20431 g_variant_new ("(b)",
20432 state));
20433}
20434
20435/**
20436 * button_complete_sim_button_press:
20437 * @object: A #Button.
20438 * @invocation: (transfer full): A #GDBusMethodInvocation.
20439 *
20440 * 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.
20441 *
20442 * This method will free @invocation, you cannot use it afterwards.
20443 */
20444void
20445button_complete_sim_button_press (
20446 Button *object,
20447 GDBusMethodInvocation *invocation)
20448{
20449 g_dbus_method_invocation_return_value (invocation,
20450 g_variant_new ("()"));
20451}
20452
20453/**
20454 * button_complete_sim_button_long_press:
20455 * @object: A #Button.
20456 * @invocation: (transfer full): A #GDBusMethodInvocation.
20457 *
20458 * 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.
20459 *
20460 * This method will free @invocation, you cannot use it afterwards.
20461 */
20462void
20463button_complete_sim_button_long_press (
20464 Button *object,
20465 GDBusMethodInvocation *invocation)
20466{
20467 g_dbus_method_invocation_return_value (invocation,
20468 g_variant_new ("()"));
20469}
20470
20471/* ------------------------------------------------------------------------ */
20472
20473/**
20474 * ButtonProxy:
20475 *
20476 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
20477 */
20478
20479/**
20480 * ButtonProxyClass:
20481 * @parent_class: The parent class.
20482 *
20483 * Class structure for #ButtonProxy.
20484 */
20485
20486struct _ButtonProxyPrivate
20487{
20488 GData *qdata;
20489};
20490
20491static void button_proxy_iface_init (ButtonIface *iface);
20492
20493#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20494G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
20495 G_ADD_PRIVATE (ButtonProxy)
20496 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
20497
20498#else
20499G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
20500 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
20501
20502#endif
20503static void
20504button_proxy_finalize (GObject *object)
20505{
20506 ButtonProxy *proxy = BUTTON_PROXY (object);
20507 g_datalist_clear (&proxy->priv->qdata);
20508 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
20509}
20510
20511static void
20512button_proxy_get_property (GObject *object,
20513 guint prop_id,
20514 GValue *value,
20515 GParamSpec *pspec G_GNUC_UNUSED)
20516{
20517 const _ExtendedGDBusPropertyInfo *info;
20518 GVariant *variant;
20519 g_assert (prop_id != 0 && prop_id - 1 < 1);
20520 info = _button_property_info_pointers[prop_id - 1];
20521 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
20522 if (info->use_gvariant)
20523 {
20524 g_value_set_variant (value, variant);
20525 }
20526 else
20527 {
20528 if (variant != NULL)
20529 g_dbus_gvariant_to_gvalue (variant, value);
20530 }
20531 if (variant != NULL)
20532 g_variant_unref (variant);
20533}
20534
20535static void
20536button_proxy_set_property_cb (GDBusProxy *proxy,
20537 GAsyncResult *res,
20538 gpointer user_data)
20539{
20540 const _ExtendedGDBusPropertyInfo *info = user_data;
20541 GError *error;
20542 GVariant *_ret;
20543 error = NULL;
20544 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
20545 if (!_ret)
20546 {
20547 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
20548 info->parent_struct.name,
20549 error->message, g_quark_to_string (error->domain), error->code);
20550 g_error_free (error);
20551 }
20552 else
20553 {
20554 g_variant_unref (_ret);
20555 }
20556}
20557
20558static void
20559button_proxy_set_property (GObject *object,
20560 guint prop_id,
20561 const GValue *value,
20562 GParamSpec *pspec G_GNUC_UNUSED)
20563{
20564 const _ExtendedGDBusPropertyInfo *info;
20565 GVariant *variant;
20566 g_assert (prop_id != 0 && prop_id - 1 < 1);
20567 info = _button_property_info_pointers[prop_id - 1];
20568 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
20569 g_dbus_proxy_call (G_DBUS_PROXY (object),
20570 "org.freedesktop.DBus.Properties.Set",
20571 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
20572 G_DBUS_CALL_FLAGS_NONE,
20573 -1,
20574 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
20575 g_variant_unref (variant);
20576}
20577
20578static void
20579button_proxy_g_signal (GDBusProxy *proxy,
20580 const gchar *sender_name G_GNUC_UNUSED,
20581 const gchar *signal_name,
20582 GVariant *parameters)
20583{
20584 _ExtendedGDBusSignalInfo *info;
20585 GVariantIter iter;
20586 GVariant *child;
20587 GValue *paramv;
20588 guint num_params;
20589 guint n;
20590 guint signal_id;
20591 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
20592 if (info == NULL)
20593 return;
20594 num_params = g_variant_n_children (parameters);
20595 paramv = g_new0 (GValue, num_params + 1);
20596 g_value_init (&paramv[0], TYPE_BUTTON);
20597 g_value_set_object (&paramv[0], proxy);
20598 g_variant_iter_init (&iter, parameters);
20599 n = 1;
20600 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20601 {
20602 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20603 if (arg_info->use_gvariant)
20604 {
20605 g_value_init (&paramv[n], G_TYPE_VARIANT);
20606 g_value_set_variant (&paramv[n], child);
20607 n++;
20608 }
20609 else
20610 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20611 g_variant_unref (child);
20612 }
20613 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
20614 g_signal_emitv (paramv, signal_id, 0, NULL);
20615 for (n = 0; n < num_params + 1; n++)
20616 g_value_unset (&paramv[n]);
20617 g_free (paramv);
20618}
20619
20620static void
20621button_proxy_g_properties_changed (GDBusProxy *_proxy,
20622 GVariant *changed_properties,
20623 const gchar *const *invalidated_properties)
20624{
20625 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
20626 guint n;
20627 const gchar *key;
20628 GVariantIter *iter;
20629 _ExtendedGDBusPropertyInfo *info;
20630 g_variant_get (changed_properties, "a{sv}", &iter);
20631 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20632 {
20633 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
20634 g_datalist_remove_data (&proxy->priv->qdata, key);
20635 if (info != NULL)
20636 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20637 }
20638 g_variant_iter_free (iter);
20639 for (n = 0; invalidated_properties[n] != NULL; n++)
20640 {
20641 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
20642 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20643 if (info != NULL)
20644 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20645 }
20646}
20647
20648static gboolean
20649button_proxy_get_state (Button *object)
20650{
20651 ButtonProxy *proxy = BUTTON_PROXY (object);
20652 GVariant *variant;
20653 gboolean value = 0;
20654 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
20655 if (variant != NULL)
20656 {
20657 value = g_variant_get_boolean (variant);
20658 g_variant_unref (variant);
20659 }
20660 return value;
20661}
20662
20663static void
20664button_proxy_init (ButtonProxy *proxy)
20665{
20666#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20667 proxy->priv = button_proxy_get_instance_private (proxy);
20668#else
20669 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
20670#endif
20671
20672 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
20673}
20674
20675static void
20676button_proxy_class_init (ButtonProxyClass *klass)
20677{
20678 GObjectClass *gobject_class;
20679 GDBusProxyClass *proxy_class;
20680
20681 gobject_class = G_OBJECT_CLASS (klass);
20682 gobject_class->finalize = button_proxy_finalize;
20683 gobject_class->get_property = button_proxy_get_property;
20684 gobject_class->set_property = button_proxy_set_property;
20685
20686 proxy_class = G_DBUS_PROXY_CLASS (klass);
20687 proxy_class->g_signal = button_proxy_g_signal;
20688 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
20689
20690 button_override_properties (gobject_class, 1);
20691
20692#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20693 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
20694#endif
20695}
20696
20697static void
20698button_proxy_iface_init (ButtonIface *iface)
20699{
20700 iface->get_state = button_proxy_get_state;
20701}
20702
20703/**
20704 * button_proxy_new:
20705 * @connection: A #GDBusConnection.
20706 * @flags: Flags from the #GDBusProxyFlags enumeration.
20707 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20708 * @object_path: An object path.
20709 * @cancellable: (allow-none): A #GCancellable or %NULL.
20710 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20711 * @user_data: User data to pass to @callback.
20712 *
20713 * 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.
20714 *
20715 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20716 * You can then call button_proxy_new_finish() to get the result of the operation.
20717 *
20718 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
20719 */
20720void
20721button_proxy_new (
20722 GDBusConnection *connection,
20723 GDBusProxyFlags flags,
20724 const gchar *name,
20725 const gchar *object_path,
20726 GCancellable *cancellable,
20727 GAsyncReadyCallback callback,
20728 gpointer user_data)
20729{
20730 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);
20731}
20732
20733/**
20734 * button_proxy_new_finish:
20735 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
20736 * @error: Return location for error or %NULL
20737 *
20738 * Finishes an operation started with button_proxy_new().
20739 *
20740 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
20741 */
20742Button *
20743button_proxy_new_finish (
20744 GAsyncResult *res,
20745 GError **error)
20746{
20747 GObject *ret;
20748 GObject *source_object;
20749 source_object = g_async_result_get_source_object (res);
20750 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20751 g_object_unref (source_object);
20752 if (ret != NULL)
20753 return BUTTON (ret);
20754 else
20755 return NULL;
20756}
20757
20758/**
20759 * button_proxy_new_sync:
20760 * @connection: A #GDBusConnection.
20761 * @flags: Flags from the #GDBusProxyFlags enumeration.
20762 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20763 * @object_path: An object path.
20764 * @cancellable: (allow-none): A #GCancellable or %NULL.
20765 * @error: Return location for error or %NULL
20766 *
20767 * 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.
20768 *
20769 * The calling thread is blocked until a reply is received.
20770 *
20771 * See button_proxy_new() for the asynchronous version of this constructor.
20772 *
20773 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
20774 */
20775Button *
20776button_proxy_new_sync (
20777 GDBusConnection *connection,
20778 GDBusProxyFlags flags,
20779 const gchar *name,
20780 const gchar *object_path,
20781 GCancellable *cancellable,
20782 GError **error)
20783{
20784 GInitable *ret;
20785 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);
20786 if (ret != NULL)
20787 return BUTTON (ret);
20788 else
20789 return NULL;
20790}
20791
20792
20793/**
20794 * button_proxy_new_for_bus:
20795 * @bus_type: A #GBusType.
20796 * @flags: Flags from the #GDBusProxyFlags enumeration.
20797 * @name: A bus name (well-known or unique).
20798 * @object_path: An object path.
20799 * @cancellable: (allow-none): A #GCancellable or %NULL.
20800 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20801 * @user_data: User data to pass to @callback.
20802 *
20803 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20804 *
20805 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20806 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
20807 *
20808 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20809 */
20810void
20811button_proxy_new_for_bus (
20812 GBusType bus_type,
20813 GDBusProxyFlags flags,
20814 const gchar *name,
20815 const gchar *object_path,
20816 GCancellable *cancellable,
20817 GAsyncReadyCallback callback,
20818 gpointer user_data)
20819{
20820 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);
20821}
20822
20823/**
20824 * button_proxy_new_for_bus_finish:
20825 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
20826 * @error: Return location for error or %NULL
20827 *
20828 * Finishes an operation started with button_proxy_new_for_bus().
20829 *
20830 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
20831 */
20832Button *
20833button_proxy_new_for_bus_finish (
20834 GAsyncResult *res,
20835 GError **error)
20836{
20837 GObject *ret;
20838 GObject *source_object;
20839 source_object = g_async_result_get_source_object (res);
20840 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20841 g_object_unref (source_object);
20842 if (ret != NULL)
20843 return BUTTON (ret);
20844 else
20845 return NULL;
20846}
20847
20848/**
20849 * button_proxy_new_for_bus_sync:
20850 * @bus_type: A #GBusType.
20851 * @flags: Flags from the #GDBusProxyFlags enumeration.
20852 * @name: A bus name (well-known or unique).
20853 * @object_path: An object path.
20854 * @cancellable: (allow-none): A #GCancellable or %NULL.
20855 * @error: Return location for error or %NULL
20856 *
20857 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
20858 *
20859 * The calling thread is blocked until a reply is received.
20860 *
20861 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
20862 *
20863 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
20864 */
20865Button *
20866button_proxy_new_for_bus_sync (
20867 GBusType bus_type,
20868 GDBusProxyFlags flags,
20869 const gchar *name,
20870 const gchar *object_path,
20871 GCancellable *cancellable,
20872 GError **error)
20873{
20874 GInitable *ret;
20875 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);
20876 if (ret != NULL)
20877 return BUTTON (ret);
20878 else
20879 return NULL;
20880}
20881
20882
20883/* ------------------------------------------------------------------------ */
20884
20885/**
20886 * ButtonSkeleton:
20887 *
20888 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
20889 */
20890
20891/**
20892 * ButtonSkeletonClass:
20893 * @parent_class: The parent class.
20894 *
20895 * Class structure for #ButtonSkeleton.
20896 */
20897
20898struct _ButtonSkeletonPrivate
20899{
20900 GValue *properties;
20901 GList *changed_properties;
20902 GSource *changed_properties_idle_source;
20903 GMainContext *context;
20904 GMutex lock;
20905};
20906
20907static void
20908_button_skeleton_handle_method_call (
20909 GDBusConnection *connection G_GNUC_UNUSED,
20910 const gchar *sender G_GNUC_UNUSED,
20911 const gchar *object_path G_GNUC_UNUSED,
20912 const gchar *interface_name,
20913 const gchar *method_name,
20914 GVariant *parameters,
20915 GDBusMethodInvocation *invocation,
20916 gpointer user_data)
20917{
20918 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
20919 _ExtendedGDBusMethodInfo *info;
20920 GVariantIter iter;
20921 GVariant *child;
20922 GValue *paramv;
20923 guint num_params;
20924 guint num_extra;
20925 guint n;
20926 guint signal_id;
20927 GValue return_value = G_VALUE_INIT;
20928 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
20929 g_assert (info != NULL);
20930 num_params = g_variant_n_children (parameters);
20931 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
20932 n = 0;
20933 g_value_init (&paramv[n], TYPE_BUTTON);
20934 g_value_set_object (&paramv[n++], skeleton);
20935 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
20936 g_value_set_object (&paramv[n++], invocation);
20937 if (info->pass_fdlist)
20938 {
20939#ifdef G_OS_UNIX
20940 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
20941 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
20942#else
20943 g_assert_not_reached ();
20944#endif
20945 }
20946 g_variant_iter_init (&iter, parameters);
20947 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20948 {
20949 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
20950 if (arg_info->use_gvariant)
20951 {
20952 g_value_init (&paramv[n], G_TYPE_VARIANT);
20953 g_value_set_variant (&paramv[n], child);
20954 n++;
20955 }
20956 else
20957 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20958 g_variant_unref (child);
20959 }
20960 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
20961 g_value_init (&return_value, G_TYPE_BOOLEAN);
20962 g_signal_emitv (paramv, signal_id, 0, &return_value);
20963 if (!g_value_get_boolean (&return_value))
20964 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);
20965 g_value_unset (&return_value);
20966 for (n = 0; n < num_params + num_extra; n++)
20967 g_value_unset (&paramv[n]);
20968 g_free (paramv);
20969}
20970
20971static GVariant *
20972_button_skeleton_handle_get_property (
20973 GDBusConnection *connection G_GNUC_UNUSED,
20974 const gchar *sender G_GNUC_UNUSED,
20975 const gchar *object_path G_GNUC_UNUSED,
20976 const gchar *interface_name G_GNUC_UNUSED,
20977 const gchar *property_name,
20978 GError **error,
20979 gpointer user_data)
20980{
20981 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
20982 GValue value = G_VALUE_INIT;
20983 GParamSpec *pspec;
20984 _ExtendedGDBusPropertyInfo *info;
20985 GVariant *ret;
20986 ret = NULL;
20987 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
20988 g_assert (info != NULL);
20989 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20990 if (pspec == NULL)
20991 {
20992 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20993 }
20994 else
20995 {
20996 g_value_init (&value, pspec->value_type);
20997 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20998 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20999 g_value_unset (&value);
21000 }
21001 return ret;
21002}
21003
21004static gboolean
21005_button_skeleton_handle_set_property (
21006 GDBusConnection *connection G_GNUC_UNUSED,
21007 const gchar *sender G_GNUC_UNUSED,
21008 const gchar *object_path G_GNUC_UNUSED,
21009 const gchar *interface_name G_GNUC_UNUSED,
21010 const gchar *property_name,
21011 GVariant *variant,
21012 GError **error,
21013 gpointer user_data)
21014{
21015 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21016 GValue value = G_VALUE_INIT;
21017 GParamSpec *pspec;
21018 _ExtendedGDBusPropertyInfo *info;
21019 gboolean ret;
21020 ret = FALSE;
21021 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21022 g_assert (info != NULL);
21023 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21024 if (pspec == NULL)
21025 {
21026 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21027 }
21028 else
21029 {
21030 if (info->use_gvariant)
21031 g_value_set_variant (&value, variant);
21032 else
21033 g_dbus_gvariant_to_gvalue (variant, &value);
21034 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21035 g_value_unset (&value);
21036 ret = TRUE;
21037 }
21038 return ret;
21039}
21040
21041static const GDBusInterfaceVTable _button_skeleton_vtable =
21042{
21043 _button_skeleton_handle_method_call,
21044 _button_skeleton_handle_get_property,
21045 _button_skeleton_handle_set_property,
21046 {NULL}
21047};
21048
21049static GDBusInterfaceInfo *
21050button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21051{
21052 return button_interface_info ();
21053}
21054
21055static GDBusInterfaceVTable *
21056button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21057{
21058 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
21059}
21060
21061static GVariant *
21062button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21063{
21064 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21065
21066 GVariantBuilder builder;
21067 guint n;
21068 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21069 if (_button_interface_info.parent_struct.properties == NULL)
21070 goto out;
21071 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
21072 {
21073 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
21074 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21075 {
21076 GVariant *value;
21077 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);
21078 if (value != NULL)
21079 {
21080 g_variant_take_ref (value);
21081 g_variant_builder_add (&builder, "{sv}", info->name, value);
21082 g_variant_unref (value);
21083 }
21084 }
21085 }
21086out:
21087 return g_variant_builder_end (&builder);
21088}
21089
21090static gboolean _button_emit_changed (gpointer user_data);
21091
21092static void
21093button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21094{
21095 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21096 gboolean emit_changed = FALSE;
21097
21098 g_mutex_lock (&skeleton->priv->lock);
21099 if (skeleton->priv->changed_properties_idle_source != NULL)
21100 {
21101 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21102 skeleton->priv->changed_properties_idle_source = NULL;
21103 emit_changed = TRUE;
21104 }
21105 g_mutex_unlock (&skeleton->priv->lock);
21106
21107 if (emit_changed)
21108 _button_emit_changed (skeleton);
21109}
21110
21111static void
21112_button_on_signal_button_release (
21113 Button *object)
21114{
21115 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21116
21117 GList *connections, *l;
21118 GVariant *signal_variant;
21119 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21120
21121 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21122 for (l = connections; l != NULL; l = l->next)
21123 {
21124 GDBusConnection *connection = l->data;
21125 g_dbus_connection_emit_signal (connection,
21126 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
21127 signal_variant, NULL);
21128 }
21129 g_variant_unref (signal_variant);
21130 g_list_free_full (connections, g_object_unref);
21131}
21132
21133static void
21134_button_on_signal_button_pressed (
21135 Button *object)
21136{
21137 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21138
21139 GList *connections, *l;
21140 GVariant *signal_variant;
21141 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21142
21143 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21144 for (l = connections; l != NULL; l = l->next)
21145 {
21146 GDBusConnection *connection = l->data;
21147 g_dbus_connection_emit_signal (connection,
21148 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
21149 signal_variant, NULL);
21150 }
21151 g_variant_unref (signal_variant);
21152 g_list_free_full (connections, g_object_unref);
21153}
21154
21155static void
21156_button_on_signal_button_pressed_long (
21157 Button *object)
21158{
21159 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21160
21161 GList *connections, *l;
21162 GVariant *signal_variant;
21163 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21164
21165 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21166 for (l = connections; l != NULL; l = l->next)
21167 {
21168 GDBusConnection *connection = l->data;
21169 g_dbus_connection_emit_signal (connection,
21170 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
21171 signal_variant, NULL);
21172 }
21173 g_variant_unref (signal_variant);
21174 g_list_free_full (connections, g_object_unref);
21175}
21176
21177static void button_skeleton_iface_init (ButtonIface *iface);
21178#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21179G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21180 G_ADD_PRIVATE (ButtonSkeleton)
21181 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21182
21183#else
21184G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21185 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21186
21187#endif
21188static void
21189button_skeleton_finalize (GObject *object)
21190{
21191 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21192 guint n;
21193 for (n = 0; n < 1; n++)
21194 g_value_unset (&skeleton->priv->properties[n]);
21195 g_free (skeleton->priv->properties);
21196 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21197 if (skeleton->priv->changed_properties_idle_source != NULL)
21198 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21199 g_main_context_unref (skeleton->priv->context);
21200 g_mutex_clear (&skeleton->priv->lock);
21201 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
21202}
21203
21204static void
21205button_skeleton_get_property (GObject *object,
21206 guint prop_id,
21207 GValue *value,
21208 GParamSpec *pspec G_GNUC_UNUSED)
21209{
21210 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21211 g_assert (prop_id != 0 && prop_id - 1 < 1);
21212 g_mutex_lock (&skeleton->priv->lock);
21213 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
21214 g_mutex_unlock (&skeleton->priv->lock);
21215}
21216
21217static gboolean
21218_button_emit_changed (gpointer user_data)
21219{
21220 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21221 GList *l;
21222 GVariantBuilder builder;
21223 GVariantBuilder invalidated_builder;
21224 guint num_changes;
21225
21226 g_mutex_lock (&skeleton->priv->lock);
21227 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21228 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
21229 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
21230 {
21231 ChangedProperty *cp = l->data;
21232 GVariant *variant;
21233 const GValue *cur_value;
21234
21235 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
21236 if (!_g_value_equal (cur_value, &cp->orig_value))
21237 {
21238 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
21239 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
21240 g_variant_unref (variant);
21241 num_changes++;
21242 }
21243 }
21244 if (num_changes > 0)
21245 {
21246 GList *connections, *ll;
21247 GVariant *signal_variant;
21248 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
21249 &builder, &invalidated_builder));
21250 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21251 for (ll = connections; ll != NULL; ll = ll->next)
21252 {
21253 GDBusConnection *connection = ll->data;
21254
21255 g_dbus_connection_emit_signal (connection,
21256 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
21257 "org.freedesktop.DBus.Properties",
21258 "PropertiesChanged",
21259 signal_variant,
21260 NULL);
21261 }
21262 g_variant_unref (signal_variant);
21263 g_list_free_full (connections, g_object_unref);
21264 }
21265 else
21266 {
21267 g_variant_builder_clear (&builder);
21268 g_variant_builder_clear (&invalidated_builder);
21269 }
21270 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21271 skeleton->priv->changed_properties = NULL;
21272 skeleton->priv->changed_properties_idle_source = NULL;
21273 g_mutex_unlock (&skeleton->priv->lock);
21274 return FALSE;
21275}
21276
21277static void
21278_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
21279{
21280 ChangedProperty *cp;
21281 GList *l;
21282 cp = NULL;
21283 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
21284 {
21285 ChangedProperty *i_cp = l->data;
21286 if (i_cp->info == info)
21287 {
21288 cp = i_cp;
21289 break;
21290 }
21291 }
21292 if (cp == NULL)
21293 {
21294 cp = g_new0 (ChangedProperty, 1);
21295 cp->prop_id = prop_id;
21296 cp->info = info;
21297 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
21298 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
21299 g_value_copy (orig_value, &cp->orig_value);
21300 }
21301}
21302
21303static void
21304button_skeleton_notify (GObject *object,
21305 GParamSpec *pspec G_GNUC_UNUSED)
21306{
21307 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21308 g_mutex_lock (&skeleton->priv->lock);
21309 if (skeleton->priv->changed_properties != NULL &&
21310 skeleton->priv->changed_properties_idle_source == NULL)
21311 {
21312 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
21313 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
21314 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
21315 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
21316 g_source_unref (skeleton->priv->changed_properties_idle_source);
21317 }
21318 g_mutex_unlock (&skeleton->priv->lock);
21319}
21320
21321static void
21322button_skeleton_set_property (GObject *object,
21323 guint prop_id,
21324 const GValue *value,
21325 GParamSpec *pspec)
21326{
21327 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21328 g_assert (prop_id != 0 && prop_id - 1 < 1);
21329 g_mutex_lock (&skeleton->priv->lock);
21330 g_object_freeze_notify (object);
21331 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
21332 {
21333 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
21334 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
21335 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
21336 g_object_notify_by_pspec (object, pspec);
21337 }
21338 g_mutex_unlock (&skeleton->priv->lock);
21339 g_object_thaw_notify (object);
21340}
21341
21342static void
21343button_skeleton_init (ButtonSkeleton *skeleton)
21344{
21345#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21346 skeleton->priv = button_skeleton_get_instance_private (skeleton);
21347#else
21348 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
21349#endif
21350
21351 g_mutex_init (&skeleton->priv->lock);
21352 skeleton->priv->context = g_main_context_ref_thread_default ();
21353 skeleton->priv->properties = g_new0 (GValue, 1);
21354 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
21355}
21356
21357static gboolean
21358button_skeleton_get_state (Button *object)
21359{
21360 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21361 gboolean value;
21362 g_mutex_lock (&skeleton->priv->lock);
21363 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
21364 g_mutex_unlock (&skeleton->priv->lock);
21365 return value;
21366}
21367
21368static void
21369button_skeleton_class_init (ButtonSkeletonClass *klass)
21370{
21371 GObjectClass *gobject_class;
21372 GDBusInterfaceSkeletonClass *skeleton_class;
21373
21374 gobject_class = G_OBJECT_CLASS (klass);
21375 gobject_class->finalize = button_skeleton_finalize;
21376 gobject_class->get_property = button_skeleton_get_property;
21377 gobject_class->set_property = button_skeleton_set_property;
21378 gobject_class->notify = button_skeleton_notify;
21379
21380
21381 button_override_properties (gobject_class, 1);
21382
21383 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21384 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
21385 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
21386 skeleton_class->flush = button_skeleton_dbus_interface_flush;
21387 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
21388
21389#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21390 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
21391#endif
21392}
21393
21394static void
21395button_skeleton_iface_init (ButtonIface *iface)
21396{
21397 iface->button_release = _button_on_signal_button_release;
21398 iface->button_pressed = _button_on_signal_button_pressed;
21399 iface->button_pressed_long = _button_on_signal_button_pressed_long;
21400 iface->get_state = button_skeleton_get_state;
21401}
21402
21403/**
21404 * button_skeleton_new:
21405 *
21406 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
21407 *
21408 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
21409 */
21410Button *
21411button_skeleton_new (void)
21412{
21413 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
21414}
21415
21416/* ------------------------------------------------------------------------
21417 * Code for interface org.openbmc.Led
21418 * ------------------------------------------------------------------------
21419 */
21420
21421/**
21422 * SECTION:Led
21423 * @title: Led
21424 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
21425 *
21426 * 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.
21427 */
21428
21429/* ---- Introspection data for org.openbmc.Led ---- */
21430
21431static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
21432{
21433 {
21434 -1,
21435 (gchar *) "setOn",
21436 NULL,
21437 NULL,
21438 NULL
21439 },
21440 "handle-set-on",
21441 FALSE
21442};
21443
21444static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
21445{
21446 {
21447 -1,
21448 (gchar *) "setOff",
21449 NULL,
21450 NULL,
21451 NULL
21452 },
21453 "handle-set-off",
21454 FALSE
21455};
21456
21457static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
21458{
21459 {
21460 -1,
21461 (gchar *) "setBlinkSlow",
21462 NULL,
21463 NULL,
21464 NULL
21465 },
21466 "handle-set-blink-slow",
21467 FALSE
21468};
21469
21470static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
21471{
21472 {
21473 -1,
21474 (gchar *) "setBlinkFast",
21475 NULL,
21476 NULL,
21477 NULL
21478 },
21479 "handle-set-blink-fast",
21480 FALSE
21481};
21482
21483static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
21484{
21485 &_led_method_info_set_on,
21486 &_led_method_info_set_off,
21487 &_led_method_info_set_blink_slow,
21488 &_led_method_info_set_blink_fast,
21489 NULL
21490};
21491
21492static const _ExtendedGDBusPropertyInfo _led_property_info_color =
21493{
21494 {
21495 -1,
21496 (gchar *) "color",
21497 (gchar *) "i",
21498 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21499 NULL
21500 },
21501 "color",
21502 FALSE
21503};
21504
21505static const _ExtendedGDBusPropertyInfo _led_property_info_function =
21506{
21507 {
21508 -1,
21509 (gchar *) "function",
21510 (gchar *) "s",
21511 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21512 NULL
21513 },
21514 "function",
21515 FALSE
21516};
21517
21518static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
21519{
21520 &_led_property_info_color,
21521 &_led_property_info_function,
21522 NULL
21523};
21524
21525static const _ExtendedGDBusInterfaceInfo _led_interface_info =
21526{
21527 {
21528 -1,
21529 (gchar *) "org.openbmc.Led",
21530 (GDBusMethodInfo **) &_led_method_info_pointers,
21531 NULL,
21532 (GDBusPropertyInfo **) &_led_property_info_pointers,
21533 NULL
21534 },
21535 "led",
21536};
21537
21538
21539/**
21540 * led_interface_info:
21541 *
21542 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
21543 *
21544 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21545 */
21546GDBusInterfaceInfo *
21547led_interface_info (void)
21548{
21549 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
21550}
21551
21552/**
21553 * led_override_properties:
21554 * @klass: The class structure for a #GObject<!-- -->-derived class.
21555 * @property_id_begin: The property id to assign to the first overridden property.
21556 *
21557 * Overrides all #GObject properties in the #Led interface for a concrete class.
21558 * The properties are overridden in the order they are defined.
21559 *
21560 * Returns: The last property id.
21561 */
21562guint
21563led_override_properties (GObjectClass *klass, guint property_id_begin)
21564{
21565 g_object_class_override_property (klass, property_id_begin++, "color");
21566 g_object_class_override_property (klass, property_id_begin++, "function");
21567 return property_id_begin - 1;
21568}
21569
21570
21571
21572/**
21573 * Led:
21574 *
21575 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
21576 */
21577
21578/**
21579 * LedIface:
21580 * @parent_iface: The parent interface.
21581 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
21582 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
21583 * @handle_set_off: Handler for the #Led::handle-set-off signal.
21584 * @handle_set_on: Handler for the #Led::handle-set-on signal.
21585 * @get_color: Getter for the #Led:color property.
21586 * @get_function: Getter for the #Led:function property.
21587 *
21588 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
21589 */
21590
21591typedef LedIface LedInterface;
21592G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
21593
21594static void
21595led_default_init (LedIface *iface)
21596{
21597 /* GObject signals for incoming D-Bus method calls: */
21598 /**
21599 * Led::handle-set-on:
21600 * @object: A #Led.
21601 * @invocation: A #GDBusMethodInvocation.
21602 *
21603 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
21604 *
21605 * 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.
21606 *
21607 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21608 */
21609 g_signal_new ("handle-set-on",
21610 G_TYPE_FROM_INTERFACE (iface),
21611 G_SIGNAL_RUN_LAST,
21612 G_STRUCT_OFFSET (LedIface, handle_set_on),
21613 g_signal_accumulator_true_handled,
21614 NULL,
21615 g_cclosure_marshal_generic,
21616 G_TYPE_BOOLEAN,
21617 1,
21618 G_TYPE_DBUS_METHOD_INVOCATION);
21619
21620 /**
21621 * Led::handle-set-off:
21622 * @object: A #Led.
21623 * @invocation: A #GDBusMethodInvocation.
21624 *
21625 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
21626 *
21627 * 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.
21628 *
21629 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21630 */
21631 g_signal_new ("handle-set-off",
21632 G_TYPE_FROM_INTERFACE (iface),
21633 G_SIGNAL_RUN_LAST,
21634 G_STRUCT_OFFSET (LedIface, handle_set_off),
21635 g_signal_accumulator_true_handled,
21636 NULL,
21637 g_cclosure_marshal_generic,
21638 G_TYPE_BOOLEAN,
21639 1,
21640 G_TYPE_DBUS_METHOD_INVOCATION);
21641
21642 /**
21643 * Led::handle-set-blink-slow:
21644 * @object: A #Led.
21645 * @invocation: A #GDBusMethodInvocation.
21646 *
21647 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
21648 *
21649 * 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.
21650 *
21651 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21652 */
21653 g_signal_new ("handle-set-blink-slow",
21654 G_TYPE_FROM_INTERFACE (iface),
21655 G_SIGNAL_RUN_LAST,
21656 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
21657 g_signal_accumulator_true_handled,
21658 NULL,
21659 g_cclosure_marshal_generic,
21660 G_TYPE_BOOLEAN,
21661 1,
21662 G_TYPE_DBUS_METHOD_INVOCATION);
21663
21664 /**
21665 * Led::handle-set-blink-fast:
21666 * @object: A #Led.
21667 * @invocation: A #GDBusMethodInvocation.
21668 *
21669 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
21670 *
21671 * 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.
21672 *
21673 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21674 */
21675 g_signal_new ("handle-set-blink-fast",
21676 G_TYPE_FROM_INTERFACE (iface),
21677 G_SIGNAL_RUN_LAST,
21678 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
21679 g_signal_accumulator_true_handled,
21680 NULL,
21681 g_cclosure_marshal_generic,
21682 G_TYPE_BOOLEAN,
21683 1,
21684 G_TYPE_DBUS_METHOD_INVOCATION);
21685
21686 /* GObject properties for D-Bus properties: */
21687 /**
21688 * Led:color:
21689 *
21690 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
21691 *
21692 * 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.
21693 */
21694 g_object_interface_install_property (iface,
21695 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21696 /**
21697 * Led:function:
21698 *
21699 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
21700 *
21701 * 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.
21702 */
21703 g_object_interface_install_property (iface,
21704 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21705}
21706
21707/**
21708 * led_get_color: (skip)
21709 * @object: A #Led.
21710 *
21711 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
21712 *
21713 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21714 *
21715 * Returns: The property value.
21716 */
21717gint
21718led_get_color (Led *object)
21719{
21720 return LED_GET_IFACE (object)->get_color (object);
21721}
21722
21723/**
21724 * led_set_color: (skip)
21725 * @object: A #Led.
21726 * @value: The value to set.
21727 *
21728 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
21729 *
21730 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21731 */
21732void
21733led_set_color (Led *object, gint value)
21734{
21735 g_object_set (G_OBJECT (object), "color", value, NULL);
21736}
21737
21738/**
21739 * led_get_function: (skip)
21740 * @object: A #Led.
21741 *
21742 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
21743 *
21744 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21745 *
21746 * <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>
21747 *
21748 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21749 */
21750const gchar *
21751led_get_function (Led *object)
21752{
21753 return LED_GET_IFACE (object)->get_function (object);
21754}
21755
21756/**
21757 * led_dup_function: (skip)
21758 * @object: A #Led.
21759 *
21760 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
21761 *
21762 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21763 *
21764 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21765 */
21766gchar *
21767led_dup_function (Led *object)
21768{
21769 gchar *value;
21770 g_object_get (G_OBJECT (object), "function", &value, NULL);
21771 return value;
21772}
21773
21774/**
21775 * led_set_function: (skip)
21776 * @object: A #Led.
21777 * @value: The value to set.
21778 *
21779 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
21780 *
21781 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21782 */
21783void
21784led_set_function (Led *object, const gchar *value)
21785{
21786 g_object_set (G_OBJECT (object), "function", value, NULL);
21787}
21788
21789/**
21790 * led_call_set_on:
21791 * @proxy: A #LedProxy.
21792 * @cancellable: (allow-none): A #GCancellable or %NULL.
21793 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21794 * @user_data: User data to pass to @callback.
21795 *
21796 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
21797 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21798 * You can then call led_call_set_on_finish() to get the result of the operation.
21799 *
21800 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
21801 */
21802void
21803led_call_set_on (
21804 Led *proxy,
21805 GCancellable *cancellable,
21806 GAsyncReadyCallback callback,
21807 gpointer user_data)
21808{
21809 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21810 "setOn",
21811 g_variant_new ("()"),
21812 G_DBUS_CALL_FLAGS_NONE,
21813 -1,
21814 cancellable,
21815 callback,
21816 user_data);
21817}
21818
21819/**
21820 * led_call_set_on_finish:
21821 * @proxy: A #LedProxy.
21822 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
21823 * @error: Return location for error or %NULL.
21824 *
21825 * Finishes an operation started with led_call_set_on().
21826 *
21827 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21828 */
21829gboolean
21830led_call_set_on_finish (
21831 Led *proxy,
21832 GAsyncResult *res,
21833 GError **error)
21834{
21835 GVariant *_ret;
21836 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21837 if (_ret == NULL)
21838 goto _out;
21839 g_variant_get (_ret,
21840 "()");
21841 g_variant_unref (_ret);
21842_out:
21843 return _ret != NULL;
21844}
21845
21846/**
21847 * led_call_set_on_sync:
21848 * @proxy: A #LedProxy.
21849 * @cancellable: (allow-none): A #GCancellable or %NULL.
21850 * @error: Return location for error or %NULL.
21851 *
21852 * 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.
21853 *
21854 * See led_call_set_on() for the asynchronous version of this method.
21855 *
21856 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21857 */
21858gboolean
21859led_call_set_on_sync (
21860 Led *proxy,
21861 GCancellable *cancellable,
21862 GError **error)
21863{
21864 GVariant *_ret;
21865 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21866 "setOn",
21867 g_variant_new ("()"),
21868 G_DBUS_CALL_FLAGS_NONE,
21869 -1,
21870 cancellable,
21871 error);
21872 if (_ret == NULL)
21873 goto _out;
21874 g_variant_get (_ret,
21875 "()");
21876 g_variant_unref (_ret);
21877_out:
21878 return _ret != NULL;
21879}
21880
21881/**
21882 * led_call_set_off:
21883 * @proxy: A #LedProxy.
21884 * @cancellable: (allow-none): A #GCancellable or %NULL.
21885 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21886 * @user_data: User data to pass to @callback.
21887 *
21888 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
21889 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21890 * You can then call led_call_set_off_finish() to get the result of the operation.
21891 *
21892 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
21893 */
21894void
21895led_call_set_off (
21896 Led *proxy,
21897 GCancellable *cancellable,
21898 GAsyncReadyCallback callback,
21899 gpointer user_data)
21900{
21901 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21902 "setOff",
21903 g_variant_new ("()"),
21904 G_DBUS_CALL_FLAGS_NONE,
21905 -1,
21906 cancellable,
21907 callback,
21908 user_data);
21909}
21910
21911/**
21912 * led_call_set_off_finish:
21913 * @proxy: A #LedProxy.
21914 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
21915 * @error: Return location for error or %NULL.
21916 *
21917 * Finishes an operation started with led_call_set_off().
21918 *
21919 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21920 */
21921gboolean
21922led_call_set_off_finish (
21923 Led *proxy,
21924 GAsyncResult *res,
21925 GError **error)
21926{
21927 GVariant *_ret;
21928 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21929 if (_ret == NULL)
21930 goto _out;
21931 g_variant_get (_ret,
21932 "()");
21933 g_variant_unref (_ret);
21934_out:
21935 return _ret != NULL;
21936}
21937
21938/**
21939 * led_call_set_off_sync:
21940 * @proxy: A #LedProxy.
21941 * @cancellable: (allow-none): A #GCancellable or %NULL.
21942 * @error: Return location for error or %NULL.
21943 *
21944 * 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.
21945 *
21946 * See led_call_set_off() for the asynchronous version of this method.
21947 *
21948 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21949 */
21950gboolean
21951led_call_set_off_sync (
21952 Led *proxy,
21953 GCancellable *cancellable,
21954 GError **error)
21955{
21956 GVariant *_ret;
21957 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21958 "setOff",
21959 g_variant_new ("()"),
21960 G_DBUS_CALL_FLAGS_NONE,
21961 -1,
21962 cancellable,
21963 error);
21964 if (_ret == NULL)
21965 goto _out;
21966 g_variant_get (_ret,
21967 "()");
21968 g_variant_unref (_ret);
21969_out:
21970 return _ret != NULL;
21971}
21972
21973/**
21974 * led_call_set_blink_slow:
21975 * @proxy: A #LedProxy.
21976 * @cancellable: (allow-none): A #GCancellable or %NULL.
21977 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21978 * @user_data: User data to pass to @callback.
21979 *
21980 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
21981 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21982 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
21983 *
21984 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
21985 */
21986void
21987led_call_set_blink_slow (
21988 Led *proxy,
21989 GCancellable *cancellable,
21990 GAsyncReadyCallback callback,
21991 gpointer user_data)
21992{
21993 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21994 "setBlinkSlow",
21995 g_variant_new ("()"),
21996 G_DBUS_CALL_FLAGS_NONE,
21997 -1,
21998 cancellable,
21999 callback,
22000 user_data);
22001}
22002
22003/**
22004 * led_call_set_blink_slow_finish:
22005 * @proxy: A #LedProxy.
22006 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
22007 * @error: Return location for error or %NULL.
22008 *
22009 * Finishes an operation started with led_call_set_blink_slow().
22010 *
22011 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22012 */
22013gboolean
22014led_call_set_blink_slow_finish (
22015 Led *proxy,
22016 GAsyncResult *res,
22017 GError **error)
22018{
22019 GVariant *_ret;
22020 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22021 if (_ret == NULL)
22022 goto _out;
22023 g_variant_get (_ret,
22024 "()");
22025 g_variant_unref (_ret);
22026_out:
22027 return _ret != NULL;
22028}
22029
22030/**
22031 * led_call_set_blink_slow_sync:
22032 * @proxy: A #LedProxy.
22033 * @cancellable: (allow-none): A #GCancellable or %NULL.
22034 * @error: Return location for error or %NULL.
22035 *
22036 * 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.
22037 *
22038 * See led_call_set_blink_slow() for the asynchronous version of this method.
22039 *
22040 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22041 */
22042gboolean
22043led_call_set_blink_slow_sync (
22044 Led *proxy,
22045 GCancellable *cancellable,
22046 GError **error)
22047{
22048 GVariant *_ret;
22049 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22050 "setBlinkSlow",
22051 g_variant_new ("()"),
22052 G_DBUS_CALL_FLAGS_NONE,
22053 -1,
22054 cancellable,
22055 error);
22056 if (_ret == NULL)
22057 goto _out;
22058 g_variant_get (_ret,
22059 "()");
22060 g_variant_unref (_ret);
22061_out:
22062 return _ret != NULL;
22063}
22064
22065/**
22066 * led_call_set_blink_fast:
22067 * @proxy: A #LedProxy.
22068 * @cancellable: (allow-none): A #GCancellable or %NULL.
22069 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22070 * @user_data: User data to pass to @callback.
22071 *
22072 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
22073 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22074 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
22075 *
22076 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
22077 */
22078void
22079led_call_set_blink_fast (
22080 Led *proxy,
22081 GCancellable *cancellable,
22082 GAsyncReadyCallback callback,
22083 gpointer user_data)
22084{
22085 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22086 "setBlinkFast",
22087 g_variant_new ("()"),
22088 G_DBUS_CALL_FLAGS_NONE,
22089 -1,
22090 cancellable,
22091 callback,
22092 user_data);
22093}
22094
22095/**
22096 * led_call_set_blink_fast_finish:
22097 * @proxy: A #LedProxy.
22098 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
22099 * @error: Return location for error or %NULL.
22100 *
22101 * Finishes an operation started with led_call_set_blink_fast().
22102 *
22103 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22104 */
22105gboolean
22106led_call_set_blink_fast_finish (
22107 Led *proxy,
22108 GAsyncResult *res,
22109 GError **error)
22110{
22111 GVariant *_ret;
22112 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22113 if (_ret == NULL)
22114 goto _out;
22115 g_variant_get (_ret,
22116 "()");
22117 g_variant_unref (_ret);
22118_out:
22119 return _ret != NULL;
22120}
22121
22122/**
22123 * led_call_set_blink_fast_sync:
22124 * @proxy: A #LedProxy.
22125 * @cancellable: (allow-none): A #GCancellable or %NULL.
22126 * @error: Return location for error or %NULL.
22127 *
22128 * 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.
22129 *
22130 * See led_call_set_blink_fast() for the asynchronous version of this method.
22131 *
22132 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22133 */
22134gboolean
22135led_call_set_blink_fast_sync (
22136 Led *proxy,
22137 GCancellable *cancellable,
22138 GError **error)
22139{
22140 GVariant *_ret;
22141 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22142 "setBlinkFast",
22143 g_variant_new ("()"),
22144 G_DBUS_CALL_FLAGS_NONE,
22145 -1,
22146 cancellable,
22147 error);
22148 if (_ret == NULL)
22149 goto _out;
22150 g_variant_get (_ret,
22151 "()");
22152 g_variant_unref (_ret);
22153_out:
22154 return _ret != NULL;
22155}
22156
22157/**
22158 * led_complete_set_on:
22159 * @object: A #Led.
22160 * @invocation: (transfer full): A #GDBusMethodInvocation.
22161 *
22162 * 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.
22163 *
22164 * This method will free @invocation, you cannot use it afterwards.
22165 */
22166void
22167led_complete_set_on (
22168 Led *object,
22169 GDBusMethodInvocation *invocation)
22170{
22171 g_dbus_method_invocation_return_value (invocation,
22172 g_variant_new ("()"));
22173}
22174
22175/**
22176 * led_complete_set_off:
22177 * @object: A #Led.
22178 * @invocation: (transfer full): A #GDBusMethodInvocation.
22179 *
22180 * 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.
22181 *
22182 * This method will free @invocation, you cannot use it afterwards.
22183 */
22184void
22185led_complete_set_off (
22186 Led *object,
22187 GDBusMethodInvocation *invocation)
22188{
22189 g_dbus_method_invocation_return_value (invocation,
22190 g_variant_new ("()"));
22191}
22192
22193/**
22194 * led_complete_set_blink_slow:
22195 * @object: A #Led.
22196 * @invocation: (transfer full): A #GDBusMethodInvocation.
22197 *
22198 * 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.
22199 *
22200 * This method will free @invocation, you cannot use it afterwards.
22201 */
22202void
22203led_complete_set_blink_slow (
22204 Led *object,
22205 GDBusMethodInvocation *invocation)
22206{
22207 g_dbus_method_invocation_return_value (invocation,
22208 g_variant_new ("()"));
22209}
22210
22211/**
22212 * led_complete_set_blink_fast:
22213 * @object: A #Led.
22214 * @invocation: (transfer full): A #GDBusMethodInvocation.
22215 *
22216 * 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.
22217 *
22218 * This method will free @invocation, you cannot use it afterwards.
22219 */
22220void
22221led_complete_set_blink_fast (
22222 Led *object,
22223 GDBusMethodInvocation *invocation)
22224{
22225 g_dbus_method_invocation_return_value (invocation,
22226 g_variant_new ("()"));
22227}
22228
22229/* ------------------------------------------------------------------------ */
22230
22231/**
22232 * LedProxy:
22233 *
22234 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
22235 */
22236
22237/**
22238 * LedProxyClass:
22239 * @parent_class: The parent class.
22240 *
22241 * Class structure for #LedProxy.
22242 */
22243
22244struct _LedProxyPrivate
22245{
22246 GData *qdata;
22247};
22248
22249static void led_proxy_iface_init (LedIface *iface);
22250
22251#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22252G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22253 G_ADD_PRIVATE (LedProxy)
22254 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22255
22256#else
22257G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22258 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22259
22260#endif
22261static void
22262led_proxy_finalize (GObject *object)
22263{
22264 LedProxy *proxy = LED_PROXY (object);
22265 g_datalist_clear (&proxy->priv->qdata);
22266 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
22267}
22268
22269static void
22270led_proxy_get_property (GObject *object,
22271 guint prop_id,
22272 GValue *value,
22273 GParamSpec *pspec G_GNUC_UNUSED)
22274{
22275 const _ExtendedGDBusPropertyInfo *info;
22276 GVariant *variant;
22277 g_assert (prop_id != 0 && prop_id - 1 < 2);
22278 info = _led_property_info_pointers[prop_id - 1];
22279 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22280 if (info->use_gvariant)
22281 {
22282 g_value_set_variant (value, variant);
22283 }
22284 else
22285 {
22286 if (variant != NULL)
22287 g_dbus_gvariant_to_gvalue (variant, value);
22288 }
22289 if (variant != NULL)
22290 g_variant_unref (variant);
22291}
22292
22293static void
22294led_proxy_set_property_cb (GDBusProxy *proxy,
22295 GAsyncResult *res,
22296 gpointer user_data)
22297{
22298 const _ExtendedGDBusPropertyInfo *info = user_data;
22299 GError *error;
22300 GVariant *_ret;
22301 error = NULL;
22302 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22303 if (!_ret)
22304 {
22305 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
22306 info->parent_struct.name,
22307 error->message, g_quark_to_string (error->domain), error->code);
22308 g_error_free (error);
22309 }
22310 else
22311 {
22312 g_variant_unref (_ret);
22313 }
22314}
22315
22316static void
22317led_proxy_set_property (GObject *object,
22318 guint prop_id,
22319 const GValue *value,
22320 GParamSpec *pspec G_GNUC_UNUSED)
22321{
22322 const _ExtendedGDBusPropertyInfo *info;
22323 GVariant *variant;
22324 g_assert (prop_id != 0 && prop_id - 1 < 2);
22325 info = _led_property_info_pointers[prop_id - 1];
22326 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22327 g_dbus_proxy_call (G_DBUS_PROXY (object),
22328 "org.freedesktop.DBus.Properties.Set",
22329 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
22330 G_DBUS_CALL_FLAGS_NONE,
22331 -1,
22332 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22333 g_variant_unref (variant);
22334}
22335
22336static void
22337led_proxy_g_signal (GDBusProxy *proxy,
22338 const gchar *sender_name G_GNUC_UNUSED,
22339 const gchar *signal_name,
22340 GVariant *parameters)
22341{
22342 _ExtendedGDBusSignalInfo *info;
22343 GVariantIter iter;
22344 GVariant *child;
22345 GValue *paramv;
22346 guint num_params;
22347 guint n;
22348 guint signal_id;
22349 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
22350 if (info == NULL)
22351 return;
22352 num_params = g_variant_n_children (parameters);
22353 paramv = g_new0 (GValue, num_params + 1);
22354 g_value_init (&paramv[0], TYPE_LED);
22355 g_value_set_object (&paramv[0], proxy);
22356 g_variant_iter_init (&iter, parameters);
22357 n = 1;
22358 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22359 {
22360 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22361 if (arg_info->use_gvariant)
22362 {
22363 g_value_init (&paramv[n], G_TYPE_VARIANT);
22364 g_value_set_variant (&paramv[n], child);
22365 n++;
22366 }
22367 else
22368 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22369 g_variant_unref (child);
22370 }
22371 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
22372 g_signal_emitv (paramv, signal_id, 0, NULL);
22373 for (n = 0; n < num_params + 1; n++)
22374 g_value_unset (&paramv[n]);
22375 g_free (paramv);
22376}
22377
22378static void
22379led_proxy_g_properties_changed (GDBusProxy *_proxy,
22380 GVariant *changed_properties,
22381 const gchar *const *invalidated_properties)
22382{
22383 LedProxy *proxy = LED_PROXY (_proxy);
22384 guint n;
22385 const gchar *key;
22386 GVariantIter *iter;
22387 _ExtendedGDBusPropertyInfo *info;
22388 g_variant_get (changed_properties, "a{sv}", &iter);
22389 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22390 {
22391 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
22392 g_datalist_remove_data (&proxy->priv->qdata, key);
22393 if (info != NULL)
22394 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22395 }
22396 g_variant_iter_free (iter);
22397 for (n = 0; invalidated_properties[n] != NULL; n++)
22398 {
22399 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
22400 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
22401 if (info != NULL)
22402 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22403 }
22404}
22405
22406static gint
22407led_proxy_get_color (Led *object)
22408{
22409 LedProxy *proxy = LED_PROXY (object);
22410 GVariant *variant;
22411 gint value = 0;
22412 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
22413 if (variant != NULL)
22414 {
22415 value = g_variant_get_int32 (variant);
22416 g_variant_unref (variant);
22417 }
22418 return value;
22419}
22420
22421static const gchar *
22422led_proxy_get_function (Led *object)
22423{
22424 LedProxy *proxy = LED_PROXY (object);
22425 GVariant *variant;
22426 const gchar *value = NULL;
22427 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
22428 if (variant != NULL)
22429 {
22430 value = g_variant_get_string (variant, NULL);
22431 g_variant_unref (variant);
22432 }
22433 return value;
22434}
22435
22436static void
22437led_proxy_init (LedProxy *proxy)
22438{
22439#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22440 proxy->priv = led_proxy_get_instance_private (proxy);
22441#else
22442 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
22443#endif
22444
22445 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
22446}
22447
22448static void
22449led_proxy_class_init (LedProxyClass *klass)
22450{
22451 GObjectClass *gobject_class;
22452 GDBusProxyClass *proxy_class;
22453
22454 gobject_class = G_OBJECT_CLASS (klass);
22455 gobject_class->finalize = led_proxy_finalize;
22456 gobject_class->get_property = led_proxy_get_property;
22457 gobject_class->set_property = led_proxy_set_property;
22458
22459 proxy_class = G_DBUS_PROXY_CLASS (klass);
22460 proxy_class->g_signal = led_proxy_g_signal;
22461 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
22462
22463 led_override_properties (gobject_class, 1);
22464
22465#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22466 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
22467#endif
22468}
22469
22470static void
22471led_proxy_iface_init (LedIface *iface)
22472{
22473 iface->get_color = led_proxy_get_color;
22474 iface->get_function = led_proxy_get_function;
22475}
22476
22477/**
22478 * led_proxy_new:
22479 * @connection: A #GDBusConnection.
22480 * @flags: Flags from the #GDBusProxyFlags enumeration.
22481 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22482 * @object_path: An object path.
22483 * @cancellable: (allow-none): A #GCancellable or %NULL.
22484 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22485 * @user_data: User data to pass to @callback.
22486 *
22487 * 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.
22488 *
22489 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22490 * You can then call led_proxy_new_finish() to get the result of the operation.
22491 *
22492 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
22493 */
22494void
22495led_proxy_new (
22496 GDBusConnection *connection,
22497 GDBusProxyFlags flags,
22498 const gchar *name,
22499 const gchar *object_path,
22500 GCancellable *cancellable,
22501 GAsyncReadyCallback callback,
22502 gpointer user_data)
22503{
22504 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);
22505}
22506
22507/**
22508 * led_proxy_new_finish:
22509 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
22510 * @error: Return location for error or %NULL
22511 *
22512 * Finishes an operation started with led_proxy_new().
22513 *
22514 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22515 */
22516Led *
22517led_proxy_new_finish (
22518 GAsyncResult *res,
22519 GError **error)
22520{
22521 GObject *ret;
22522 GObject *source_object;
22523 source_object = g_async_result_get_source_object (res);
22524 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22525 g_object_unref (source_object);
22526 if (ret != NULL)
22527 return LED (ret);
22528 else
22529 return NULL;
22530}
22531
22532/**
22533 * led_proxy_new_sync:
22534 * @connection: A #GDBusConnection.
22535 * @flags: Flags from the #GDBusProxyFlags enumeration.
22536 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22537 * @object_path: An object path.
22538 * @cancellable: (allow-none): A #GCancellable or %NULL.
22539 * @error: Return location for error or %NULL
22540 *
22541 * 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.
22542 *
22543 * The calling thread is blocked until a reply is received.
22544 *
22545 * See led_proxy_new() for the asynchronous version of this constructor.
22546 *
22547 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22548 */
22549Led *
22550led_proxy_new_sync (
22551 GDBusConnection *connection,
22552 GDBusProxyFlags flags,
22553 const gchar *name,
22554 const gchar *object_path,
22555 GCancellable *cancellable,
22556 GError **error)
22557{
22558 GInitable *ret;
22559 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);
22560 if (ret != NULL)
22561 return LED (ret);
22562 else
22563 return NULL;
22564}
22565
22566
22567/**
22568 * led_proxy_new_for_bus:
22569 * @bus_type: A #GBusType.
22570 * @flags: Flags from the #GDBusProxyFlags enumeration.
22571 * @name: A bus name (well-known or unique).
22572 * @object_path: An object path.
22573 * @cancellable: (allow-none): A #GCancellable or %NULL.
22574 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22575 * @user_data: User data to pass to @callback.
22576 *
22577 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
22578 *
22579 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22580 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
22581 *
22582 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
22583 */
22584void
22585led_proxy_new_for_bus (
22586 GBusType bus_type,
22587 GDBusProxyFlags flags,
22588 const gchar *name,
22589 const gchar *object_path,
22590 GCancellable *cancellable,
22591 GAsyncReadyCallback callback,
22592 gpointer user_data)
22593{
22594 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);
22595}
22596
22597/**
22598 * led_proxy_new_for_bus_finish:
22599 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
22600 * @error: Return location for error or %NULL
22601 *
22602 * Finishes an operation started with led_proxy_new_for_bus().
22603 *
22604 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22605 */
22606Led *
22607led_proxy_new_for_bus_finish (
22608 GAsyncResult *res,
22609 GError **error)
22610{
22611 GObject *ret;
22612 GObject *source_object;
22613 source_object = g_async_result_get_source_object (res);
22614 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22615 g_object_unref (source_object);
22616 if (ret != NULL)
22617 return LED (ret);
22618 else
22619 return NULL;
22620}
22621
22622/**
22623 * led_proxy_new_for_bus_sync:
22624 * @bus_type: A #GBusType.
22625 * @flags: Flags from the #GDBusProxyFlags enumeration.
22626 * @name: A bus name (well-known or unique).
22627 * @object_path: An object path.
22628 * @cancellable: (allow-none): A #GCancellable or %NULL.
22629 * @error: Return location for error or %NULL
22630 *
22631 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
22632 *
22633 * The calling thread is blocked until a reply is received.
22634 *
22635 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
22636 *
22637 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22638 */
22639Led *
22640led_proxy_new_for_bus_sync (
22641 GBusType bus_type,
22642 GDBusProxyFlags flags,
22643 const gchar *name,
22644 const gchar *object_path,
22645 GCancellable *cancellable,
22646 GError **error)
22647{
22648 GInitable *ret;
22649 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);
22650 if (ret != NULL)
22651 return LED (ret);
22652 else
22653 return NULL;
22654}
22655
22656
22657/* ------------------------------------------------------------------------ */
22658
22659/**
22660 * LedSkeleton:
22661 *
22662 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
22663 */
22664
22665/**
22666 * LedSkeletonClass:
22667 * @parent_class: The parent class.
22668 *
22669 * Class structure for #LedSkeleton.
22670 */
22671
22672struct _LedSkeletonPrivate
22673{
22674 GValue *properties;
22675 GList *changed_properties;
22676 GSource *changed_properties_idle_source;
22677 GMainContext *context;
22678 GMutex lock;
22679};
22680
22681static void
22682_led_skeleton_handle_method_call (
22683 GDBusConnection *connection G_GNUC_UNUSED,
22684 const gchar *sender G_GNUC_UNUSED,
22685 const gchar *object_path G_GNUC_UNUSED,
22686 const gchar *interface_name,
22687 const gchar *method_name,
22688 GVariant *parameters,
22689 GDBusMethodInvocation *invocation,
22690 gpointer user_data)
22691{
22692 LedSkeleton *skeleton = LED_SKELETON (user_data);
22693 _ExtendedGDBusMethodInfo *info;
22694 GVariantIter iter;
22695 GVariant *child;
22696 GValue *paramv;
22697 guint num_params;
22698 guint num_extra;
22699 guint n;
22700 guint signal_id;
22701 GValue return_value = G_VALUE_INIT;
22702 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
22703 g_assert (info != NULL);
22704 num_params = g_variant_n_children (parameters);
22705 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
22706 n = 0;
22707 g_value_init (&paramv[n], TYPE_LED);
22708 g_value_set_object (&paramv[n++], skeleton);
22709 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
22710 g_value_set_object (&paramv[n++], invocation);
22711 if (info->pass_fdlist)
22712 {
22713#ifdef G_OS_UNIX
22714 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
22715 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
22716#else
22717 g_assert_not_reached ();
22718#endif
22719 }
22720 g_variant_iter_init (&iter, parameters);
22721 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22722 {
22723 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
22724 if (arg_info->use_gvariant)
22725 {
22726 g_value_init (&paramv[n], G_TYPE_VARIANT);
22727 g_value_set_variant (&paramv[n], child);
22728 n++;
22729 }
22730 else
22731 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22732 g_variant_unref (child);
22733 }
22734 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
22735 g_value_init (&return_value, G_TYPE_BOOLEAN);
22736 g_signal_emitv (paramv, signal_id, 0, &return_value);
22737 if (!g_value_get_boolean (&return_value))
22738 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);
22739 g_value_unset (&return_value);
22740 for (n = 0; n < num_params + num_extra; n++)
22741 g_value_unset (&paramv[n]);
22742 g_free (paramv);
22743}
22744
22745static GVariant *
22746_led_skeleton_handle_get_property (
22747 GDBusConnection *connection G_GNUC_UNUSED,
22748 const gchar *sender G_GNUC_UNUSED,
22749 const gchar *object_path G_GNUC_UNUSED,
22750 const gchar *interface_name G_GNUC_UNUSED,
22751 const gchar *property_name,
22752 GError **error,
22753 gpointer user_data)
22754{
22755 LedSkeleton *skeleton = LED_SKELETON (user_data);
22756 GValue value = G_VALUE_INIT;
22757 GParamSpec *pspec;
22758 _ExtendedGDBusPropertyInfo *info;
22759 GVariant *ret;
22760 ret = NULL;
22761 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
22762 g_assert (info != NULL);
22763 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22764 if (pspec == NULL)
22765 {
22766 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22767 }
22768 else
22769 {
22770 g_value_init (&value, pspec->value_type);
22771 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22772 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
22773 g_value_unset (&value);
22774 }
22775 return ret;
22776}
22777
22778static gboolean
22779_led_skeleton_handle_set_property (
22780 GDBusConnection *connection G_GNUC_UNUSED,
22781 const gchar *sender G_GNUC_UNUSED,
22782 const gchar *object_path G_GNUC_UNUSED,
22783 const gchar *interface_name G_GNUC_UNUSED,
22784 const gchar *property_name,
22785 GVariant *variant,
22786 GError **error,
22787 gpointer user_data)
22788{
22789 LedSkeleton *skeleton = LED_SKELETON (user_data);
22790 GValue value = G_VALUE_INIT;
22791 GParamSpec *pspec;
22792 _ExtendedGDBusPropertyInfo *info;
22793 gboolean ret;
22794 ret = FALSE;
22795 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
22796 g_assert (info != NULL);
22797 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22798 if (pspec == NULL)
22799 {
22800 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22801 }
22802 else
22803 {
22804 if (info->use_gvariant)
22805 g_value_set_variant (&value, variant);
22806 else
22807 g_dbus_gvariant_to_gvalue (variant, &value);
22808 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22809 g_value_unset (&value);
22810 ret = TRUE;
22811 }
22812 return ret;
22813}
22814
22815static const GDBusInterfaceVTable _led_skeleton_vtable =
22816{
22817 _led_skeleton_handle_method_call,
22818 _led_skeleton_handle_get_property,
22819 _led_skeleton_handle_set_property,
22820 {NULL}
22821};
22822
22823static GDBusInterfaceInfo *
22824led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22825{
22826 return led_interface_info ();
22827}
22828
22829static GDBusInterfaceVTable *
22830led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22831{
22832 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
22833}
22834
22835static GVariant *
22836led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
22837{
22838 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
22839
22840 GVariantBuilder builder;
22841 guint n;
22842 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22843 if (_led_interface_info.parent_struct.properties == NULL)
22844 goto out;
22845 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
22846 {
22847 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
22848 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
22849 {
22850 GVariant *value;
22851 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);
22852 if (value != NULL)
22853 {
22854 g_variant_take_ref (value);
22855 g_variant_builder_add (&builder, "{sv}", info->name, value);
22856 g_variant_unref (value);
22857 }
22858 }
22859 }
22860out:
22861 return g_variant_builder_end (&builder);
22862}
22863
22864static gboolean _led_emit_changed (gpointer user_data);
22865
22866static void
22867led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
22868{
22869 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
22870 gboolean emit_changed = FALSE;
22871
22872 g_mutex_lock (&skeleton->priv->lock);
22873 if (skeleton->priv->changed_properties_idle_source != NULL)
22874 {
22875 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22876 skeleton->priv->changed_properties_idle_source = NULL;
22877 emit_changed = TRUE;
22878 }
22879 g_mutex_unlock (&skeleton->priv->lock);
22880
22881 if (emit_changed)
22882 _led_emit_changed (skeleton);
22883}
22884
22885static void led_skeleton_iface_init (LedIface *iface);
22886#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22887G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22888 G_ADD_PRIVATE (LedSkeleton)
22889 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
22890
22891#else
22892G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22893 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
22894
22895#endif
22896static void
22897led_skeleton_finalize (GObject *object)
22898{
22899 LedSkeleton *skeleton = LED_SKELETON (object);
22900 guint n;
22901 for (n = 0; n < 2; n++)
22902 g_value_unset (&skeleton->priv->properties[n]);
22903 g_free (skeleton->priv->properties);
22904 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22905 if (skeleton->priv->changed_properties_idle_source != NULL)
22906 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22907 g_main_context_unref (skeleton->priv->context);
22908 g_mutex_clear (&skeleton->priv->lock);
22909 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
22910}
22911
22912static void
22913led_skeleton_get_property (GObject *object,
22914 guint prop_id,
22915 GValue *value,
22916 GParamSpec *pspec G_GNUC_UNUSED)
22917{
22918 LedSkeleton *skeleton = LED_SKELETON (object);
22919 g_assert (prop_id != 0 && prop_id - 1 < 2);
22920 g_mutex_lock (&skeleton->priv->lock);
22921 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
22922 g_mutex_unlock (&skeleton->priv->lock);
22923}
22924
22925static gboolean
22926_led_emit_changed (gpointer user_data)
22927{
22928 LedSkeleton *skeleton = LED_SKELETON (user_data);
22929 GList *l;
22930 GVariantBuilder builder;
22931 GVariantBuilder invalidated_builder;
22932 guint num_changes;
22933
22934 g_mutex_lock (&skeleton->priv->lock);
22935 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22936 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
22937 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
22938 {
22939 ChangedProperty *cp = l->data;
22940 GVariant *variant;
22941 const GValue *cur_value;
22942
22943 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
22944 if (!_g_value_equal (cur_value, &cp->orig_value))
22945 {
22946 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
22947 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
22948 g_variant_unref (variant);
22949 num_changes++;
22950 }
22951 }
22952 if (num_changes > 0)
22953 {
22954 GList *connections, *ll;
22955 GVariant *signal_variant;
22956 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
22957 &builder, &invalidated_builder));
22958 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22959 for (ll = connections; ll != NULL; ll = ll->next)
22960 {
22961 GDBusConnection *connection = ll->data;
22962
22963 g_dbus_connection_emit_signal (connection,
22964 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
22965 "org.freedesktop.DBus.Properties",
22966 "PropertiesChanged",
22967 signal_variant,
22968 NULL);
22969 }
22970 g_variant_unref (signal_variant);
22971 g_list_free_full (connections, g_object_unref);
22972 }
22973 else
22974 {
22975 g_variant_builder_clear (&builder);
22976 g_variant_builder_clear (&invalidated_builder);
22977 }
22978 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22979 skeleton->priv->changed_properties = NULL;
22980 skeleton->priv->changed_properties_idle_source = NULL;
22981 g_mutex_unlock (&skeleton->priv->lock);
22982 return FALSE;
22983}
22984
22985static void
22986_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
22987{
22988 ChangedProperty *cp;
22989 GList *l;
22990 cp = NULL;
22991 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
22992 {
22993 ChangedProperty *i_cp = l->data;
22994 if (i_cp->info == info)
22995 {
22996 cp = i_cp;
22997 break;
22998 }
22999 }
23000 if (cp == NULL)
23001 {
23002 cp = g_new0 (ChangedProperty, 1);
23003 cp->prop_id = prop_id;
23004 cp->info = info;
23005 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23006 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23007 g_value_copy (orig_value, &cp->orig_value);
23008 }
23009}
23010
23011static void
23012led_skeleton_notify (GObject *object,
23013 GParamSpec *pspec G_GNUC_UNUSED)
23014{
23015 LedSkeleton *skeleton = LED_SKELETON (object);
23016 g_mutex_lock (&skeleton->priv->lock);
23017 if (skeleton->priv->changed_properties != NULL &&
23018 skeleton->priv->changed_properties_idle_source == NULL)
23019 {
23020 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23021 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23022 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23023 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23024 g_source_unref (skeleton->priv->changed_properties_idle_source);
23025 }
23026 g_mutex_unlock (&skeleton->priv->lock);
23027}
23028
23029static void
23030led_skeleton_set_property (GObject *object,
23031 guint prop_id,
23032 const GValue *value,
23033 GParamSpec *pspec)
23034{
23035 LedSkeleton *skeleton = LED_SKELETON (object);
23036 g_assert (prop_id != 0 && prop_id - 1 < 2);
23037 g_mutex_lock (&skeleton->priv->lock);
23038 g_object_freeze_notify (object);
23039 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23040 {
23041 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23042 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23043 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23044 g_object_notify_by_pspec (object, pspec);
23045 }
23046 g_mutex_unlock (&skeleton->priv->lock);
23047 g_object_thaw_notify (object);
23048}
23049
23050static void
23051led_skeleton_init (LedSkeleton *skeleton)
23052{
23053#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23054 skeleton->priv = led_skeleton_get_instance_private (skeleton);
23055#else
23056 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
23057#endif
23058
23059 g_mutex_init (&skeleton->priv->lock);
23060 skeleton->priv->context = g_main_context_ref_thread_default ();
23061 skeleton->priv->properties = g_new0 (GValue, 2);
23062 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
23063 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23064}
23065
23066static gint
23067led_skeleton_get_color (Led *object)
23068{
23069 LedSkeleton *skeleton = LED_SKELETON (object);
23070 gint value;
23071 g_mutex_lock (&skeleton->priv->lock);
23072 value = g_value_get_int (&(skeleton->priv->properties[0]));
23073 g_mutex_unlock (&skeleton->priv->lock);
23074 return value;
23075}
23076
23077static const gchar *
23078led_skeleton_get_function (Led *object)
23079{
23080 LedSkeleton *skeleton = LED_SKELETON (object);
23081 const gchar *value;
23082 g_mutex_lock (&skeleton->priv->lock);
23083 value = g_value_get_string (&(skeleton->priv->properties[1]));
23084 g_mutex_unlock (&skeleton->priv->lock);
23085 return value;
23086}
23087
23088static void
23089led_skeleton_class_init (LedSkeletonClass *klass)
23090{
23091 GObjectClass *gobject_class;
23092 GDBusInterfaceSkeletonClass *skeleton_class;
23093
23094 gobject_class = G_OBJECT_CLASS (klass);
23095 gobject_class->finalize = led_skeleton_finalize;
23096 gobject_class->get_property = led_skeleton_get_property;
23097 gobject_class->set_property = led_skeleton_set_property;
23098 gobject_class->notify = led_skeleton_notify;
23099
23100
23101 led_override_properties (gobject_class, 1);
23102
23103 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23104 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
23105 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
23106 skeleton_class->flush = led_skeleton_dbus_interface_flush;
23107 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
23108
23109#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23110 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
23111#endif
23112}
23113
23114static void
23115led_skeleton_iface_init (LedIface *iface)
23116{
23117 iface->get_color = led_skeleton_get_color;
23118 iface->get_function = led_skeleton_get_function;
23119}
23120
23121/**
23122 * led_skeleton_new:
23123 *
23124 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
23125 *
23126 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
23127 */
23128Led *
23129led_skeleton_new (void)
23130{
23131 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
23132}
23133
23134/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023135 * Code for interface org.openbmc.HostIpmi
23136 * ------------------------------------------------------------------------
23137 */
23138
23139/**
23140 * SECTION:HostIpmi
23141 * @title: HostIpmi
23142 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
23143 *
23144 * 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.
23145 */
23146
23147/* ---- Introspection data for org.openbmc.HostIpmi ---- */
23148
23149static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
23150{
23151 {
23152 -1,
23153 (gchar *) "seq",
23154 (gchar *) "y",
23155 NULL
23156 },
23157 FALSE
23158};
23159
23160static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
23161{
23162 {
23163 -1,
23164 (gchar *) "netfn",
23165 (gchar *) "y",
23166 NULL
23167 },
23168 FALSE
23169};
23170
23171static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
23172{
23173 {
23174 -1,
23175 (gchar *) "cmd",
23176 (gchar *) "y",
23177 NULL
23178 },
23179 FALSE
23180};
23181
23182static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
23183{
23184 {
23185 -1,
23186 (gchar *) "data",
23187 (gchar *) "ay",
23188 NULL
23189 },
23190 FALSE
23191};
23192
23193static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
23194{
23195 &_host_ipmi_method_info_send_message_IN_ARG_seq,
23196 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
23197 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
23198 &_host_ipmi_method_info_send_message_IN_ARG_data,
23199 NULL
23200};
23201
23202static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
23203{
23204 {
23205 -1,
23206 (gchar *) "unnamed_arg4",
23207 (gchar *) "x",
23208 NULL
23209 },
23210 FALSE
23211};
23212
23213static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
23214{
23215 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
23216 NULL
23217};
23218
23219static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
23220{
23221 {
23222 -1,
23223 (gchar *) "sendMessage",
23224 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
23225 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
23226 NULL
23227 },
23228 "handle-send-message",
23229 FALSE
23230};
23231
23232static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
23233{
23234 &_host_ipmi_method_info_send_message,
23235 NULL
23236};
23237
23238static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
23239{
23240 {
23241 -1,
23242 (gchar *) "seq",
23243 (gchar *) "y",
23244 NULL
23245 },
23246 FALSE
23247};
23248
23249static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
23250{
23251 {
23252 -1,
23253 (gchar *) "netfn",
23254 (gchar *) "y",
23255 NULL
23256 },
23257 FALSE
23258};
23259
23260static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
23261{
23262 {
23263 -1,
23264 (gchar *) "cmd",
23265 (gchar *) "y",
23266 NULL
23267 },
23268 FALSE
23269};
23270
23271static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
23272{
23273 {
23274 -1,
23275 (gchar *) "data",
23276 (gchar *) "ay",
23277 NULL
23278 },
23279 FALSE
23280};
23281
23282static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
23283{
23284 &_host_ipmi_signal_info_received_message_ARG_seq,
23285 &_host_ipmi_signal_info_received_message_ARG_netfn,
23286 &_host_ipmi_signal_info_received_message_ARG_cmd,
23287 &_host_ipmi_signal_info_received_message_ARG_data,
23288 NULL
23289};
23290
23291static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
23292{
23293 {
23294 -1,
23295 (gchar *) "ReceivedMessage",
23296 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
23297 NULL
23298 },
23299 "received-message"
23300};
23301
23302static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
23303{
23304 &_host_ipmi_signal_info_received_message,
23305 NULL
23306};
23307
23308static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
23309{
23310 {
23311 -1,
23312 (gchar *) "org.openbmc.HostIpmi",
23313 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
23314 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
23315 NULL,
23316 NULL
23317 },
23318 "host-ipmi",
23319};
23320
23321
23322/**
23323 * host_ipmi_interface_info:
23324 *
23325 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
23326 *
23327 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
23328 */
23329GDBusInterfaceInfo *
23330host_ipmi_interface_info (void)
23331{
23332 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
23333}
23334
23335/**
23336 * host_ipmi_override_properties:
23337 * @klass: The class structure for a #GObject<!-- -->-derived class.
23338 * @property_id_begin: The property id to assign to the first overridden property.
23339 *
23340 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
23341 * The properties are overridden in the order they are defined.
23342 *
23343 * Returns: The last property id.
23344 */
23345guint
23346host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
23347{
23348 return property_id_begin - 1;
23349}
23350
23351
23352
23353/**
23354 * HostIpmi:
23355 *
23356 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
23357 */
23358
23359/**
23360 * HostIpmiIface:
23361 * @parent_iface: The parent interface.
23362 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
23363 * @received_message: Handler for the #HostIpmi::received-message signal.
23364 *
23365 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
23366 */
23367
23368typedef HostIpmiIface HostIpmiInterface;
23369G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
23370
23371static void
23372host_ipmi_default_init (HostIpmiIface *iface)
23373{
23374 /* GObject signals for incoming D-Bus method calls: */
23375 /**
23376 * HostIpmi::handle-send-message:
23377 * @object: A #HostIpmi.
23378 * @invocation: A #GDBusMethodInvocation.
23379 * @arg_seq: Argument passed by remote caller.
23380 * @arg_netfn: Argument passed by remote caller.
23381 * @arg_cmd: Argument passed by remote caller.
23382 * @arg_data: Argument passed by remote caller.
23383 *
23384 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
23385 *
23386 * 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.
23387 *
23388 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
23389 */
23390 g_signal_new ("handle-send-message",
23391 G_TYPE_FROM_INTERFACE (iface),
23392 G_SIGNAL_RUN_LAST,
23393 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
23394 g_signal_accumulator_true_handled,
23395 NULL,
23396 g_cclosure_marshal_generic,
23397 G_TYPE_BOOLEAN,
23398 5,
23399 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
23400
23401 /* GObject signals for received D-Bus signals: */
23402 /**
23403 * HostIpmi::received-message:
23404 * @object: A #HostIpmi.
23405 * @arg_seq: Argument.
23406 * @arg_netfn: Argument.
23407 * @arg_cmd: Argument.
23408 * @arg_data: Argument.
23409 *
23410 * 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.
23411 *
23412 * 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.
23413 */
23414 g_signal_new ("received-message",
23415 G_TYPE_FROM_INTERFACE (iface),
23416 G_SIGNAL_RUN_LAST,
23417 G_STRUCT_OFFSET (HostIpmiIface, received_message),
23418 NULL,
23419 NULL,
23420 g_cclosure_marshal_generic,
23421 G_TYPE_NONE,
23422 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
23423
23424}
23425
23426/**
23427 * host_ipmi_emit_received_message:
23428 * @object: A #HostIpmi.
23429 * @arg_seq: Argument to pass with the signal.
23430 * @arg_netfn: Argument to pass with the signal.
23431 * @arg_cmd: Argument to pass with the signal.
23432 * @arg_data: Argument to pass with the signal.
23433 *
23434 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
23435 */
23436void
23437host_ipmi_emit_received_message (
23438 HostIpmi *object,
23439 guchar arg_seq,
23440 guchar arg_netfn,
23441 guchar arg_cmd,
23442 const gchar *arg_data)
23443{
23444 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
23445}
23446
23447/**
23448 * host_ipmi_call_send_message:
23449 * @proxy: A #HostIpmiProxy.
23450 * @arg_seq: Argument to pass with the method invocation.
23451 * @arg_netfn: Argument to pass with the method invocation.
23452 * @arg_cmd: Argument to pass with the method invocation.
23453 * @arg_data: Argument to pass with the method invocation.
23454 * @cancellable: (allow-none): A #GCancellable or %NULL.
23455 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23456 * @user_data: User data to pass to @callback.
23457 *
23458 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
23459 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23460 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
23461 *
23462 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
23463 */
23464void
23465host_ipmi_call_send_message (
23466 HostIpmi *proxy,
23467 guchar arg_seq,
23468 guchar arg_netfn,
23469 guchar arg_cmd,
23470 const gchar *arg_data,
23471 GCancellable *cancellable,
23472 GAsyncReadyCallback callback,
23473 gpointer user_data)
23474{
23475 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23476 "sendMessage",
23477 g_variant_new ("(yyy^ay)",
23478 arg_seq,
23479 arg_netfn,
23480 arg_cmd,
23481 arg_data),
23482 G_DBUS_CALL_FLAGS_NONE,
23483 -1,
23484 cancellable,
23485 callback,
23486 user_data);
23487}
23488
23489/**
23490 * host_ipmi_call_send_message_finish:
23491 * @proxy: A #HostIpmiProxy.
23492 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
23493 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
23494 * @error: Return location for error or %NULL.
23495 *
23496 * Finishes an operation started with host_ipmi_call_send_message().
23497 *
23498 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23499 */
23500gboolean
23501host_ipmi_call_send_message_finish (
23502 HostIpmi *proxy,
23503 gint64 *out_unnamed_arg4,
23504 GAsyncResult *res,
23505 GError **error)
23506{
23507 GVariant *_ret;
23508 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23509 if (_ret == NULL)
23510 goto _out;
23511 g_variant_get (_ret,
23512 "(x)",
23513 out_unnamed_arg4);
23514 g_variant_unref (_ret);
23515_out:
23516 return _ret != NULL;
23517}
23518
23519/**
23520 * host_ipmi_call_send_message_sync:
23521 * @proxy: A #HostIpmiProxy.
23522 * @arg_seq: Argument to pass with the method invocation.
23523 * @arg_netfn: Argument to pass with the method invocation.
23524 * @arg_cmd: Argument to pass with the method invocation.
23525 * @arg_data: Argument to pass with the method invocation.
23526 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
23527 * @cancellable: (allow-none): A #GCancellable or %NULL.
23528 * @error: Return location for error or %NULL.
23529 *
23530 * 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.
23531 *
23532 * See host_ipmi_call_send_message() for the asynchronous version of this method.
23533 *
23534 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23535 */
23536gboolean
23537host_ipmi_call_send_message_sync (
23538 HostIpmi *proxy,
23539 guchar arg_seq,
23540 guchar arg_netfn,
23541 guchar arg_cmd,
23542 const gchar *arg_data,
23543 gint64 *out_unnamed_arg4,
23544 GCancellable *cancellable,
23545 GError **error)
23546{
23547 GVariant *_ret;
23548 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23549 "sendMessage",
23550 g_variant_new ("(yyy^ay)",
23551 arg_seq,
23552 arg_netfn,
23553 arg_cmd,
23554 arg_data),
23555 G_DBUS_CALL_FLAGS_NONE,
23556 -1,
23557 cancellable,
23558 error);
23559 if (_ret == NULL)
23560 goto _out;
23561 g_variant_get (_ret,
23562 "(x)",
23563 out_unnamed_arg4);
23564 g_variant_unref (_ret);
23565_out:
23566 return _ret != NULL;
23567}
23568
23569/**
23570 * host_ipmi_complete_send_message:
23571 * @object: A #HostIpmi.
23572 * @invocation: (transfer full): A #GDBusMethodInvocation.
23573 * @unnamed_arg4: Parameter to return.
23574 *
23575 * 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.
23576 *
23577 * This method will free @invocation, you cannot use it afterwards.
23578 */
23579void
23580host_ipmi_complete_send_message (
23581 HostIpmi *object,
23582 GDBusMethodInvocation *invocation,
23583 gint64 unnamed_arg4)
23584{
23585 g_dbus_method_invocation_return_value (invocation,
23586 g_variant_new ("(x)",
23587 unnamed_arg4));
23588}
23589
23590/* ------------------------------------------------------------------------ */
23591
23592/**
23593 * HostIpmiProxy:
23594 *
23595 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
23596 */
23597
23598/**
23599 * HostIpmiProxyClass:
23600 * @parent_class: The parent class.
23601 *
23602 * Class structure for #HostIpmiProxy.
23603 */
23604
23605struct _HostIpmiProxyPrivate
23606{
23607 GData *qdata;
23608};
23609
23610static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
23611
23612#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23613G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
23614 G_ADD_PRIVATE (HostIpmiProxy)
23615 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
23616
23617#else
23618G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
23619 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
23620
23621#endif
23622static void
23623host_ipmi_proxy_finalize (GObject *object)
23624{
23625 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
23626 g_datalist_clear (&proxy->priv->qdata);
23627 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
23628}
23629
23630static void
23631host_ipmi_proxy_get_property (GObject *object,
23632 guint prop_id,
23633 GValue *value,
23634 GParamSpec *pspec G_GNUC_UNUSED)
23635{
23636}
23637
23638static void
23639host_ipmi_proxy_set_property (GObject *object,
23640 guint prop_id,
23641 const GValue *value,
23642 GParamSpec *pspec G_GNUC_UNUSED)
23643{
23644}
23645
23646static void
23647host_ipmi_proxy_g_signal (GDBusProxy *proxy,
23648 const gchar *sender_name G_GNUC_UNUSED,
23649 const gchar *signal_name,
23650 GVariant *parameters)
23651{
23652 _ExtendedGDBusSignalInfo *info;
23653 GVariantIter iter;
23654 GVariant *child;
23655 GValue *paramv;
23656 guint num_params;
23657 guint n;
23658 guint signal_id;
23659 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
23660 if (info == NULL)
23661 return;
23662 num_params = g_variant_n_children (parameters);
23663 paramv = g_new0 (GValue, num_params + 1);
23664 g_value_init (&paramv[0], TYPE_HOST_IPMI);
23665 g_value_set_object (&paramv[0], proxy);
23666 g_variant_iter_init (&iter, parameters);
23667 n = 1;
23668 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23669 {
23670 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23671 if (arg_info->use_gvariant)
23672 {
23673 g_value_init (&paramv[n], G_TYPE_VARIANT);
23674 g_value_set_variant (&paramv[n], child);
23675 n++;
23676 }
23677 else
23678 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23679 g_variant_unref (child);
23680 }
23681 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
23682 g_signal_emitv (paramv, signal_id, 0, NULL);
23683 for (n = 0; n < num_params + 1; n++)
23684 g_value_unset (&paramv[n]);
23685 g_free (paramv);
23686}
23687
23688static void
23689host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
23690 GVariant *changed_properties,
23691 const gchar *const *invalidated_properties)
23692{
23693 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
23694 guint n;
23695 const gchar *key;
23696 GVariantIter *iter;
23697 _ExtendedGDBusPropertyInfo *info;
23698 g_variant_get (changed_properties, "a{sv}", &iter);
23699 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23700 {
23701 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
23702 g_datalist_remove_data (&proxy->priv->qdata, key);
23703 if (info != NULL)
23704 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23705 }
23706 g_variant_iter_free (iter);
23707 for (n = 0; invalidated_properties[n] != NULL; n++)
23708 {
23709 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
23710 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23711 if (info != NULL)
23712 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23713 }
23714}
23715
23716static void
23717host_ipmi_proxy_init (HostIpmiProxy *proxy)
23718{
23719#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23720 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
23721#else
23722 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
23723#endif
23724
23725 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
23726}
23727
23728static void
23729host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
23730{
23731 GObjectClass *gobject_class;
23732 GDBusProxyClass *proxy_class;
23733
23734 gobject_class = G_OBJECT_CLASS (klass);
23735 gobject_class->finalize = host_ipmi_proxy_finalize;
23736 gobject_class->get_property = host_ipmi_proxy_get_property;
23737 gobject_class->set_property = host_ipmi_proxy_set_property;
23738
23739 proxy_class = G_DBUS_PROXY_CLASS (klass);
23740 proxy_class->g_signal = host_ipmi_proxy_g_signal;
23741 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
23742
23743#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23744 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
23745#endif
23746}
23747
23748static void
23749host_ipmi_proxy_iface_init (HostIpmiIface *iface)
23750{
23751}
23752
23753/**
23754 * host_ipmi_proxy_new:
23755 * @connection: A #GDBusConnection.
23756 * @flags: Flags from the #GDBusProxyFlags enumeration.
23757 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23758 * @object_path: An object path.
23759 * @cancellable: (allow-none): A #GCancellable or %NULL.
23760 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23761 * @user_data: User data to pass to @callback.
23762 *
23763 * 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.
23764 *
23765 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23766 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
23767 *
23768 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
23769 */
23770void
23771host_ipmi_proxy_new (
23772 GDBusConnection *connection,
23773 GDBusProxyFlags flags,
23774 const gchar *name,
23775 const gchar *object_path,
23776 GCancellable *cancellable,
23777 GAsyncReadyCallback callback,
23778 gpointer user_data)
23779{
23780 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);
23781}
23782
23783/**
23784 * host_ipmi_proxy_new_finish:
23785 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
23786 * @error: Return location for error or %NULL
23787 *
23788 * Finishes an operation started with host_ipmi_proxy_new().
23789 *
23790 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
23791 */
23792HostIpmi *
23793host_ipmi_proxy_new_finish (
23794 GAsyncResult *res,
23795 GError **error)
23796{
23797 GObject *ret;
23798 GObject *source_object;
23799 source_object = g_async_result_get_source_object (res);
23800 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23801 g_object_unref (source_object);
23802 if (ret != NULL)
23803 return HOST_IPMI (ret);
23804 else
23805 return NULL;
23806}
23807
23808/**
23809 * host_ipmi_proxy_new_sync:
23810 * @connection: A #GDBusConnection.
23811 * @flags: Flags from the #GDBusProxyFlags enumeration.
23812 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23813 * @object_path: An object path.
23814 * @cancellable: (allow-none): A #GCancellable or %NULL.
23815 * @error: Return location for error or %NULL
23816 *
23817 * 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.
23818 *
23819 * The calling thread is blocked until a reply is received.
23820 *
23821 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
23822 *
23823 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
23824 */
23825HostIpmi *
23826host_ipmi_proxy_new_sync (
23827 GDBusConnection *connection,
23828 GDBusProxyFlags flags,
23829 const gchar *name,
23830 const gchar *object_path,
23831 GCancellable *cancellable,
23832 GError **error)
23833{
23834 GInitable *ret;
23835 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);
23836 if (ret != NULL)
23837 return HOST_IPMI (ret);
23838 else
23839 return NULL;
23840}
23841
23842
23843/**
23844 * host_ipmi_proxy_new_for_bus:
23845 * @bus_type: A #GBusType.
23846 * @flags: Flags from the #GDBusProxyFlags enumeration.
23847 * @name: A bus name (well-known or unique).
23848 * @object_path: An object path.
23849 * @cancellable: (allow-none): A #GCancellable or %NULL.
23850 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23851 * @user_data: User data to pass to @callback.
23852 *
23853 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23854 *
23855 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23856 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
23857 *
23858 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23859 */
23860void
23861host_ipmi_proxy_new_for_bus (
23862 GBusType bus_type,
23863 GDBusProxyFlags flags,
23864 const gchar *name,
23865 const gchar *object_path,
23866 GCancellable *cancellable,
23867 GAsyncReadyCallback callback,
23868 gpointer user_data)
23869{
23870 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);
23871}
23872
23873/**
23874 * host_ipmi_proxy_new_for_bus_finish:
23875 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
23876 * @error: Return location for error or %NULL
23877 *
23878 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
23879 *
23880 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
23881 */
23882HostIpmi *
23883host_ipmi_proxy_new_for_bus_finish (
23884 GAsyncResult *res,
23885 GError **error)
23886{
23887 GObject *ret;
23888 GObject *source_object;
23889 source_object = g_async_result_get_source_object (res);
23890 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23891 g_object_unref (source_object);
23892 if (ret != NULL)
23893 return HOST_IPMI (ret);
23894 else
23895 return NULL;
23896}
23897
23898/**
23899 * host_ipmi_proxy_new_for_bus_sync:
23900 * @bus_type: A #GBusType.
23901 * @flags: Flags from the #GDBusProxyFlags enumeration.
23902 * @name: A bus name (well-known or unique).
23903 * @object_path: An object path.
23904 * @cancellable: (allow-none): A #GCancellable or %NULL.
23905 * @error: Return location for error or %NULL
23906 *
23907 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23908 *
23909 * The calling thread is blocked until a reply is received.
23910 *
23911 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
23912 *
23913 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
23914 */
23915HostIpmi *
23916host_ipmi_proxy_new_for_bus_sync (
23917 GBusType bus_type,
23918 GDBusProxyFlags flags,
23919 const gchar *name,
23920 const gchar *object_path,
23921 GCancellable *cancellable,
23922 GError **error)
23923{
23924 GInitable *ret;
23925 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);
23926 if (ret != NULL)
23927 return HOST_IPMI (ret);
23928 else
23929 return NULL;
23930}
23931
23932
23933/* ------------------------------------------------------------------------ */
23934
23935/**
23936 * HostIpmiSkeleton:
23937 *
23938 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
23939 */
23940
23941/**
23942 * HostIpmiSkeletonClass:
23943 * @parent_class: The parent class.
23944 *
23945 * Class structure for #HostIpmiSkeleton.
23946 */
23947
23948struct _HostIpmiSkeletonPrivate
23949{
23950 GValue *properties;
23951 GList *changed_properties;
23952 GSource *changed_properties_idle_source;
23953 GMainContext *context;
23954 GMutex lock;
23955};
23956
23957static void
23958_host_ipmi_skeleton_handle_method_call (
23959 GDBusConnection *connection G_GNUC_UNUSED,
23960 const gchar *sender G_GNUC_UNUSED,
23961 const gchar *object_path G_GNUC_UNUSED,
23962 const gchar *interface_name,
23963 const gchar *method_name,
23964 GVariant *parameters,
23965 GDBusMethodInvocation *invocation,
23966 gpointer user_data)
23967{
23968 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
23969 _ExtendedGDBusMethodInfo *info;
23970 GVariantIter iter;
23971 GVariant *child;
23972 GValue *paramv;
23973 guint num_params;
23974 guint num_extra;
23975 guint n;
23976 guint signal_id;
23977 GValue return_value = G_VALUE_INIT;
23978 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23979 g_assert (info != NULL);
23980 num_params = g_variant_n_children (parameters);
23981 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23982 n = 0;
23983 g_value_init (&paramv[n], TYPE_HOST_IPMI);
23984 g_value_set_object (&paramv[n++], skeleton);
23985 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23986 g_value_set_object (&paramv[n++], invocation);
23987 if (info->pass_fdlist)
23988 {
23989#ifdef G_OS_UNIX
23990 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23991 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23992#else
23993 g_assert_not_reached ();
23994#endif
23995 }
23996 g_variant_iter_init (&iter, parameters);
23997 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23998 {
23999 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
24000 if (arg_info->use_gvariant)
24001 {
24002 g_value_init (&paramv[n], G_TYPE_VARIANT);
24003 g_value_set_variant (&paramv[n], child);
24004 n++;
24005 }
24006 else
24007 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24008 g_variant_unref (child);
24009 }
24010 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
24011 g_value_init (&return_value, G_TYPE_BOOLEAN);
24012 g_signal_emitv (paramv, signal_id, 0, &return_value);
24013 if (!g_value_get_boolean (&return_value))
24014 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);
24015 g_value_unset (&return_value);
24016 for (n = 0; n < num_params + num_extra; n++)
24017 g_value_unset (&paramv[n]);
24018 g_free (paramv);
24019}
24020
24021static GVariant *
24022_host_ipmi_skeleton_handle_get_property (
24023 GDBusConnection *connection G_GNUC_UNUSED,
24024 const gchar *sender G_GNUC_UNUSED,
24025 const gchar *object_path G_GNUC_UNUSED,
24026 const gchar *interface_name G_GNUC_UNUSED,
24027 const gchar *property_name,
24028 GError **error,
24029 gpointer user_data)
24030{
24031 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
24032 GValue value = G_VALUE_INIT;
24033 GParamSpec *pspec;
24034 _ExtendedGDBusPropertyInfo *info;
24035 GVariant *ret;
24036 ret = NULL;
24037 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
24038 g_assert (info != NULL);
24039 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24040 if (pspec == NULL)
24041 {
24042 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24043 }
24044 else
24045 {
24046 g_value_init (&value, pspec->value_type);
24047 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24048 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
24049 g_value_unset (&value);
24050 }
24051 return ret;
24052}
24053
24054static gboolean
24055_host_ipmi_skeleton_handle_set_property (
24056 GDBusConnection *connection G_GNUC_UNUSED,
24057 const gchar *sender G_GNUC_UNUSED,
24058 const gchar *object_path G_GNUC_UNUSED,
24059 const gchar *interface_name G_GNUC_UNUSED,
24060 const gchar *property_name,
24061 GVariant *variant,
24062 GError **error,
24063 gpointer user_data)
24064{
24065 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
24066 GValue value = G_VALUE_INIT;
24067 GParamSpec *pspec;
24068 _ExtendedGDBusPropertyInfo *info;
24069 gboolean ret;
24070 ret = FALSE;
24071 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
24072 g_assert (info != NULL);
24073 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24074 if (pspec == NULL)
24075 {
24076 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24077 }
24078 else
24079 {
24080 if (info->use_gvariant)
24081 g_value_set_variant (&value, variant);
24082 else
24083 g_dbus_gvariant_to_gvalue (variant, &value);
24084 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24085 g_value_unset (&value);
24086 ret = TRUE;
24087 }
24088 return ret;
24089}
24090
24091static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
24092{
24093 _host_ipmi_skeleton_handle_method_call,
24094 _host_ipmi_skeleton_handle_get_property,
24095 _host_ipmi_skeleton_handle_set_property,
24096 {NULL}
24097};
24098
24099static GDBusInterfaceInfo *
24100host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24101{
24102 return host_ipmi_interface_info ();
24103}
24104
24105static GDBusInterfaceVTable *
24106host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24107{
24108 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
24109}
24110
24111static GVariant *
24112host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
24113{
24114 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
24115
24116 GVariantBuilder builder;
24117 guint n;
24118 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24119 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
24120 goto out;
24121 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
24122 {
24123 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
24124 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
24125 {
24126 GVariant *value;
24127 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);
24128 if (value != NULL)
24129 {
24130 g_variant_take_ref (value);
24131 g_variant_builder_add (&builder, "{sv}", info->name, value);
24132 g_variant_unref (value);
24133 }
24134 }
24135 }
24136out:
24137 return g_variant_builder_end (&builder);
24138}
24139
24140static void
24141host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
24142{
24143}
24144
24145static void
24146_host_ipmi_on_signal_received_message (
24147 HostIpmi *object,
24148 guchar arg_seq,
24149 guchar arg_netfn,
24150 guchar arg_cmd,
24151 const gchar *arg_data)
24152{
24153 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
24154
24155 GList *connections, *l;
24156 GVariant *signal_variant;
24157 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24158
24159 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
24160 arg_seq,
24161 arg_netfn,
24162 arg_cmd,
24163 arg_data));
24164 for (l = connections; l != NULL; l = l->next)
24165 {
24166 GDBusConnection *connection = l->data;
24167 g_dbus_connection_emit_signal (connection,
24168 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
24169 signal_variant, NULL);
24170 }
24171 g_variant_unref (signal_variant);
24172 g_list_free_full (connections, g_object_unref);
24173}
24174
24175static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
24176#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24177G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24178 G_ADD_PRIVATE (HostIpmiSkeleton)
24179 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
24180
24181#else
24182G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24183 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
24184
24185#endif
24186static void
24187host_ipmi_skeleton_finalize (GObject *object)
24188{
24189 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
24190 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24191 if (skeleton->priv->changed_properties_idle_source != NULL)
24192 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24193 g_main_context_unref (skeleton->priv->context);
24194 g_mutex_clear (&skeleton->priv->lock);
24195 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
24196}
24197
24198static void
24199host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
24200{
24201#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24202 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
24203#else
24204 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
24205#endif
24206
24207 g_mutex_init (&skeleton->priv->lock);
24208 skeleton->priv->context = g_main_context_ref_thread_default ();
24209}
24210
24211static void
24212host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
24213{
24214 GObjectClass *gobject_class;
24215 GDBusInterfaceSkeletonClass *skeleton_class;
24216
24217 gobject_class = G_OBJECT_CLASS (klass);
24218 gobject_class->finalize = host_ipmi_skeleton_finalize;
24219
24220 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
24221 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
24222 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
24223 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
24224 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
24225
24226#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24227 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
24228#endif
24229}
24230
24231static void
24232host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
24233{
24234 iface->received_message = _host_ipmi_on_signal_received_message;
24235}
24236
24237/**
24238 * host_ipmi_skeleton_new:
24239 *
24240 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
24241 *
24242 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
24243 */
24244HostIpmi *
24245host_ipmi_skeleton_new (void)
24246{
24247 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
24248}
24249
24250/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050024251 * Code for Object, ObjectProxy and ObjectSkeleton
24252 * ------------------------------------------------------------------------
24253 */
24254
24255/**
24256 * SECTION:Object
24257 * @title: Object
24258 * @short_description: Specialized GDBusObject types
24259 *
24260 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
24261 */
24262
24263/**
24264 * Object:
24265 *
24266 * The #Object type is a specialized container of interfaces.
24267 */
24268
24269/**
24270 * ObjectIface:
24271 * @parent_iface: The parent interface.
24272 *
24273 * Virtual table for the #Object interface.
24274 */
24275
24276typedef ObjectIface ObjectInterface;
24277G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
24278
24279static void
24280object_default_init (ObjectIface *iface)
24281{
24282 /**
24283 * Object:occ:
24284 *
24285 * 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.
24286 *
24287 * Connect to the #GObject::notify signal to get informed of property changes.
24288 */
24289 g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24290
24291 /**
24292 * Object:fan:
24293 *
24294 * 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.
24295 *
24296 * Connect to the #GObject::notify signal to get informed of property changes.
24297 */
24298 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24299
24300 /**
24301 * Object:sensor-value:
24302 *
24303 * 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.
24304 *
24305 * Connect to the #GObject::notify signal to get informed of property changes.
24306 */
24307 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));
24308
24309 /**
24310 * Object:sensor-threshold:
24311 *
24312 * 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.
24313 *
24314 * Connect to the #GObject::notify signal to get informed of property changes.
24315 */
24316 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));
24317
24318 /**
24319 * Object:sensor-i2c:
24320 *
24321 * 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.
24322 *
24323 * Connect to the #GObject::notify signal to get informed of property changes.
24324 */
24325 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));
24326
24327 /**
24328 * Object:sensor-match:
24329 *
24330 * 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.
24331 *
24332 * Connect to the #GObject::notify signal to get informed of property changes.
24333 */
24334 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));
24335
24336 /**
24337 * Object:process:
24338 *
24339 * 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.
24340 *
24341 * Connect to the #GObject::notify signal to get informed of property changes.
24342 */
24343 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24344
24345 /**
24346 * Object:control:
24347 *
24348 * 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.
24349 *
24350 * Connect to the #GObject::notify signal to get informed of property changes.
24351 */
24352 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24353
24354 /**
24355 * Object:control-bmc:
24356 *
24357 * 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.
24358 *
24359 * Connect to the #GObject::notify signal to get informed of property changes.
24360 */
24361 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));
24362
24363 /**
24364 * Object:control-host:
24365 *
24366 * 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.
24367 *
24368 * Connect to the #GObject::notify signal to get informed of property changes.
24369 */
24370 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));
24371
24372 /**
24373 * Object:control-power:
24374 *
24375 * 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.
24376 *
24377 * Connect to the #GObject::notify signal to get informed of property changes.
24378 */
24379 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));
24380
24381 /**
24382 * Object:watchdog:
24383 *
24384 * 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.
24385 *
24386 * Connect to the #GObject::notify signal to get informed of property changes.
24387 */
24388 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24389
24390 /**
24391 * Object:event-log:
24392 *
24393 * 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.
24394 *
24395 * Connect to the #GObject::notify signal to get informed of property changes.
24396 */
24397 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));
24398
24399 /**
24400 * Object:flash:
24401 *
24402 * 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.
24403 *
24404 * Connect to the #GObject::notify signal to get informed of property changes.
24405 */
24406 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24407
24408 /**
24409 * Object:button:
24410 *
24411 * 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.
24412 *
24413 * Connect to the #GObject::notify signal to get informed of property changes.
24414 */
24415 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24416
24417 /**
24418 * Object:led:
24419 *
24420 * 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.
24421 *
24422 * Connect to the #GObject::notify signal to get informed of property changes.
24423 */
24424 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24425
Norman Jamesdbcffbd2015-10-06 16:53:06 -050024426 /**
24427 * Object:host-ipmi:
24428 *
24429 * 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.
24430 *
24431 * Connect to the #GObject::notify signal to get informed of property changes.
24432 */
24433 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));
24434
Norman James362a80f2015-09-14 14:04:39 -050024435}
24436
24437/**
24438 * object_get_occ:
24439 * @object: A #Object.
24440 *
24441 * 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.
24442 *
24443 * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24444 */
24445Occ *object_get_occ (Object *object)
24446{
24447 GDBusInterface *ret;
24448 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24449 if (ret == NULL)
24450 return NULL;
24451 return OCC (ret);
24452}
24453
24454/**
24455 * object_get_fan:
24456 * @object: A #Object.
24457 *
24458 * 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.
24459 *
24460 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24461 */
24462Fan *object_get_fan (Object *object)
24463{
24464 GDBusInterface *ret;
24465 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24466 if (ret == NULL)
24467 return NULL;
24468 return FAN (ret);
24469}
24470
24471/**
24472 * object_get_sensor_value:
24473 * @object: A #Object.
24474 *
24475 * 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.
24476 *
24477 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24478 */
24479SensorValue *object_get_sensor_value (Object *object)
24480{
24481 GDBusInterface *ret;
24482 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24483 if (ret == NULL)
24484 return NULL;
24485 return SENSOR_VALUE (ret);
24486}
24487
24488/**
24489 * object_get_sensor_threshold:
24490 * @object: A #Object.
24491 *
24492 * 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.
24493 *
24494 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24495 */
24496SensorThreshold *object_get_sensor_threshold (Object *object)
24497{
24498 GDBusInterface *ret;
24499 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24500 if (ret == NULL)
24501 return NULL;
24502 return SENSOR_THRESHOLD (ret);
24503}
24504
24505/**
24506 * object_get_sensor_i2c:
24507 * @object: A #Object.
24508 *
24509 * 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.
24510 *
24511 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24512 */
24513SensorI2c *object_get_sensor_i2c (Object *object)
24514{
24515 GDBusInterface *ret;
24516 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24517 if (ret == NULL)
24518 return NULL;
24519 return SENSOR_I2C (ret);
24520}
24521
24522/**
24523 * object_get_sensor_match:
24524 * @object: A #Object.
24525 *
24526 * 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.
24527 *
24528 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24529 */
24530SensorMatch *object_get_sensor_match (Object *object)
24531{
24532 GDBusInterface *ret;
24533 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24534 if (ret == NULL)
24535 return NULL;
24536 return SENSOR_MATCH (ret);
24537}
24538
24539/**
24540 * object_get_process:
24541 * @object: A #Object.
24542 *
24543 * 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.
24544 *
24545 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24546 */
24547Process *object_get_process (Object *object)
24548{
24549 GDBusInterface *ret;
24550 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24551 if (ret == NULL)
24552 return NULL;
24553 return PROCESS (ret);
24554}
24555
24556/**
24557 * object_get_control:
24558 * @object: A #Object.
24559 *
24560 * 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.
24561 *
24562 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24563 */
24564Control *object_get_control (Object *object)
24565{
24566 GDBusInterface *ret;
24567 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24568 if (ret == NULL)
24569 return NULL;
24570 return CONTROL (ret);
24571}
24572
24573/**
24574 * object_get_control_bmc:
24575 * @object: A #Object.
24576 *
24577 * 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.
24578 *
24579 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24580 */
24581ControlBmc *object_get_control_bmc (Object *object)
24582{
24583 GDBusInterface *ret;
24584 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24585 if (ret == NULL)
24586 return NULL;
24587 return CONTROL_BMC (ret);
24588}
24589
24590/**
24591 * object_get_control_host:
24592 * @object: A #Object.
24593 *
24594 * 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.
24595 *
24596 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24597 */
24598ControlHost *object_get_control_host (Object *object)
24599{
24600 GDBusInterface *ret;
24601 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24602 if (ret == NULL)
24603 return NULL;
24604 return CONTROL_HOST (ret);
24605}
24606
24607/**
24608 * object_get_control_power:
24609 * @object: A #Object.
24610 *
24611 * 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.
24612 *
24613 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24614 */
24615ControlPower *object_get_control_power (Object *object)
24616{
24617 GDBusInterface *ret;
24618 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24619 if (ret == NULL)
24620 return NULL;
24621 return CONTROL_POWER (ret);
24622}
24623
24624/**
24625 * object_get_watchdog:
24626 * @object: A #Object.
24627 *
24628 * 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.
24629 *
24630 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24631 */
24632Watchdog *object_get_watchdog (Object *object)
24633{
24634 GDBusInterface *ret;
24635 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24636 if (ret == NULL)
24637 return NULL;
24638 return WATCHDOG (ret);
24639}
24640
24641/**
24642 * object_get_event_log:
24643 * @object: A #Object.
24644 *
24645 * 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.
24646 *
24647 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24648 */
24649EventLog *object_get_event_log (Object *object)
24650{
24651 GDBusInterface *ret;
24652 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24653 if (ret == NULL)
24654 return NULL;
24655 return EVENT_LOG (ret);
24656}
24657
24658/**
24659 * object_get_flash:
24660 * @object: A #Object.
24661 *
24662 * 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.
24663 *
24664 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24665 */
24666Flash *object_get_flash (Object *object)
24667{
24668 GDBusInterface *ret;
24669 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24670 if (ret == NULL)
24671 return NULL;
24672 return FLASH (ret);
24673}
24674
24675/**
24676 * object_get_button:
24677 * @object: A #Object.
24678 *
24679 * 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.
24680 *
24681 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24682 */
24683Button *object_get_button (Object *object)
24684{
24685 GDBusInterface *ret;
24686 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24687 if (ret == NULL)
24688 return NULL;
24689 return BUTTON (ret);
24690}
24691
24692/**
24693 * object_get_led:
24694 * @object: A #Object.
24695 *
24696 * 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.
24697 *
24698 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24699 */
24700Led *object_get_led (Object *object)
24701{
24702 GDBusInterface *ret;
24703 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24704 if (ret == NULL)
24705 return NULL;
24706 return LED (ret);
24707}
24708
Norman Jamesdbcffbd2015-10-06 16:53:06 -050024709/**
24710 * object_get_host_ipmi:
24711 * @object: A #Object.
24712 *
24713 * 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.
24714 *
24715 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24716 */
24717HostIpmi *object_get_host_ipmi (Object *object)
24718{
24719 GDBusInterface *ret;
24720 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
24721 if (ret == NULL)
24722 return NULL;
24723 return HOST_IPMI (ret);
24724}
24725
Norman James362a80f2015-09-14 14:04:39 -050024726
24727/**
24728 * object_peek_occ: (skip)
24729 * @object: A #Object.
24730 *
24731 * Like object_get_occ() but doesn't increase the reference count on the returned object.
24732 *
24733 * <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>
24734 *
24735 * 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.
24736 */
24737Occ *object_peek_occ (Object *object)
24738{
24739 GDBusInterface *ret;
24740 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24741 if (ret == NULL)
24742 return NULL;
24743 g_object_unref (ret);
24744 return OCC (ret);
24745}
24746
24747/**
24748 * object_peek_fan: (skip)
24749 * @object: A #Object.
24750 *
24751 * Like object_get_fan() but doesn't increase the reference count on the returned object.
24752 *
24753 * <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>
24754 *
24755 * 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.
24756 */
24757Fan *object_peek_fan (Object *object)
24758{
24759 GDBusInterface *ret;
24760 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24761 if (ret == NULL)
24762 return NULL;
24763 g_object_unref (ret);
24764 return FAN (ret);
24765}
24766
24767/**
24768 * object_peek_sensor_value: (skip)
24769 * @object: A #Object.
24770 *
24771 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
24772 *
24773 * <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>
24774 *
24775 * 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.
24776 */
24777SensorValue *object_peek_sensor_value (Object *object)
24778{
24779 GDBusInterface *ret;
24780 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24781 if (ret == NULL)
24782 return NULL;
24783 g_object_unref (ret);
24784 return SENSOR_VALUE (ret);
24785}
24786
24787/**
24788 * object_peek_sensor_threshold: (skip)
24789 * @object: A #Object.
24790 *
24791 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
24792 *
24793 * <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>
24794 *
24795 * 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.
24796 */
24797SensorThreshold *object_peek_sensor_threshold (Object *object)
24798{
24799 GDBusInterface *ret;
24800 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24801 if (ret == NULL)
24802 return NULL;
24803 g_object_unref (ret);
24804 return SENSOR_THRESHOLD (ret);
24805}
24806
24807/**
24808 * object_peek_sensor_i2c: (skip)
24809 * @object: A #Object.
24810 *
24811 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
24812 *
24813 * <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>
24814 *
24815 * 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.
24816 */
24817SensorI2c *object_peek_sensor_i2c (Object *object)
24818{
24819 GDBusInterface *ret;
24820 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24821 if (ret == NULL)
24822 return NULL;
24823 g_object_unref (ret);
24824 return SENSOR_I2C (ret);
24825}
24826
24827/**
24828 * object_peek_sensor_match: (skip)
24829 * @object: A #Object.
24830 *
24831 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
24832 *
24833 * <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>
24834 *
24835 * 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.
24836 */
24837SensorMatch *object_peek_sensor_match (Object *object)
24838{
24839 GDBusInterface *ret;
24840 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24841 if (ret == NULL)
24842 return NULL;
24843 g_object_unref (ret);
24844 return SENSOR_MATCH (ret);
24845}
24846
24847/**
24848 * object_peek_process: (skip)
24849 * @object: A #Object.
24850 *
24851 * Like object_get_process() but doesn't increase the reference count on the returned object.
24852 *
24853 * <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>
24854 *
24855 * 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.
24856 */
24857Process *object_peek_process (Object *object)
24858{
24859 GDBusInterface *ret;
24860 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24861 if (ret == NULL)
24862 return NULL;
24863 g_object_unref (ret);
24864 return PROCESS (ret);
24865}
24866
24867/**
24868 * object_peek_control: (skip)
24869 * @object: A #Object.
24870 *
24871 * Like object_get_control() but doesn't increase the reference count on the returned object.
24872 *
24873 * <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>
24874 *
24875 * 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.
24876 */
24877Control *object_peek_control (Object *object)
24878{
24879 GDBusInterface *ret;
24880 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24881 if (ret == NULL)
24882 return NULL;
24883 g_object_unref (ret);
24884 return CONTROL (ret);
24885}
24886
24887/**
24888 * object_peek_control_bmc: (skip)
24889 * @object: A #Object.
24890 *
24891 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
24892 *
24893 * <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>
24894 *
24895 * 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.
24896 */
24897ControlBmc *object_peek_control_bmc (Object *object)
24898{
24899 GDBusInterface *ret;
24900 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24901 if (ret == NULL)
24902 return NULL;
24903 g_object_unref (ret);
24904 return CONTROL_BMC (ret);
24905}
24906
24907/**
24908 * object_peek_control_host: (skip)
24909 * @object: A #Object.
24910 *
24911 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
24912 *
24913 * <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>
24914 *
24915 * 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.
24916 */
24917ControlHost *object_peek_control_host (Object *object)
24918{
24919 GDBusInterface *ret;
24920 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24921 if (ret == NULL)
24922 return NULL;
24923 g_object_unref (ret);
24924 return CONTROL_HOST (ret);
24925}
24926
24927/**
24928 * object_peek_control_power: (skip)
24929 * @object: A #Object.
24930 *
24931 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
24932 *
24933 * <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>
24934 *
24935 * 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.
24936 */
24937ControlPower *object_peek_control_power (Object *object)
24938{
24939 GDBusInterface *ret;
24940 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24941 if (ret == NULL)
24942 return NULL;
24943 g_object_unref (ret);
24944 return CONTROL_POWER (ret);
24945}
24946
24947/**
24948 * object_peek_watchdog: (skip)
24949 * @object: A #Object.
24950 *
24951 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
24952 *
24953 * <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>
24954 *
24955 * 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.
24956 */
24957Watchdog *object_peek_watchdog (Object *object)
24958{
24959 GDBusInterface *ret;
24960 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24961 if (ret == NULL)
24962 return NULL;
24963 g_object_unref (ret);
24964 return WATCHDOG (ret);
24965}
24966
24967/**
24968 * object_peek_event_log: (skip)
24969 * @object: A #Object.
24970 *
24971 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
24972 *
24973 * <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>
24974 *
24975 * 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.
24976 */
24977EventLog *object_peek_event_log (Object *object)
24978{
24979 GDBusInterface *ret;
24980 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24981 if (ret == NULL)
24982 return NULL;
24983 g_object_unref (ret);
24984 return EVENT_LOG (ret);
24985}
24986
24987/**
24988 * object_peek_flash: (skip)
24989 * @object: A #Object.
24990 *
24991 * Like object_get_flash() but doesn't increase the reference count on the returned object.
24992 *
24993 * <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>
24994 *
24995 * 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.
24996 */
24997Flash *object_peek_flash (Object *object)
24998{
24999 GDBusInterface *ret;
25000 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
25001 if (ret == NULL)
25002 return NULL;
25003 g_object_unref (ret);
25004 return FLASH (ret);
25005}
25006
25007/**
25008 * object_peek_button: (skip)
25009 * @object: A #Object.
25010 *
25011 * Like object_get_button() but doesn't increase the reference count on the returned object.
25012 *
25013 * <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>
25014 *
25015 * 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.
25016 */
25017Button *object_peek_button (Object *object)
25018{
25019 GDBusInterface *ret;
25020 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25021 if (ret == NULL)
25022 return NULL;
25023 g_object_unref (ret);
25024 return BUTTON (ret);
25025}
25026
25027/**
25028 * object_peek_led: (skip)
25029 * @object: A #Object.
25030 *
25031 * Like object_get_led() but doesn't increase the reference count on the returned object.
25032 *
25033 * <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>
25034 *
25035 * 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.
25036 */
25037Led *object_peek_led (Object *object)
25038{
25039 GDBusInterface *ret;
25040 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25041 if (ret == NULL)
25042 return NULL;
25043 g_object_unref (ret);
25044 return LED (ret);
25045}
25046
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025047/**
25048 * object_peek_host_ipmi: (skip)
25049 * @object: A #Object.
25050 *
25051 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
25052 *
25053 * <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>
25054 *
25055 * 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.
25056 */
25057HostIpmi *object_peek_host_ipmi (Object *object)
25058{
25059 GDBusInterface *ret;
25060 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
25061 if (ret == NULL)
25062 return NULL;
25063 g_object_unref (ret);
25064 return HOST_IPMI (ret);
25065}
25066
Norman James362a80f2015-09-14 14:04:39 -050025067
25068static void
25069object_notify (GDBusObject *object, GDBusInterface *interface)
25070{
25071 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
25072 /* info can be NULL if the other end is using a D-Bus interface we don't know
25073 * anything about, for example old generated code in this process talking to
25074 * newer generated code in the other process. */
25075 if (info != NULL)
25076 g_object_notify (G_OBJECT (object), info->hyphen_name);
25077}
25078
25079/**
25080 * ObjectProxy:
25081 *
25082 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
25083 */
25084
25085/**
25086 * ObjectProxyClass:
25087 * @parent_class: The parent class.
25088 *
25089 * Class structure for #ObjectProxy.
25090 */
25091
25092static void
25093object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
25094{
25095}
25096
25097static void
25098object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
25099{
25100 iface->interface_added = object_notify;
25101 iface->interface_removed = object_notify;
25102}
25103
25104
25105G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
25106 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
25107 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
25108
25109static void
25110object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
25111{
25112}
25113
25114static void
25115object_proxy_set_property (GObject *gobject,
25116 guint prop_id,
25117 const GValue *value G_GNUC_UNUSED,
25118 GParamSpec *pspec)
25119{
25120 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25121}
25122
25123static void
25124object_proxy_get_property (GObject *gobject,
25125 guint prop_id,
25126 GValue *value,
25127 GParamSpec *pspec)
25128{
25129 ObjectProxy *object = OBJECT_PROXY (gobject);
25130 GDBusInterface *interface;
25131
25132 switch (prop_id)
25133 {
25134 case 1:
25135 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
25136 g_value_take_object (value, interface);
25137 break;
25138
25139 case 2:
25140 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
25141 g_value_take_object (value, interface);
25142 break;
25143
25144 case 3:
25145 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
25146 g_value_take_object (value, interface);
25147 break;
25148
25149 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025150 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050025151 g_value_take_object (value, interface);
25152 break;
25153
Norman James19e45912015-10-04 20:19:41 -050025154 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025155 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050025156 g_value_take_object (value, interface);
25157 break;
25158
Norman James19e45912015-10-04 20:19:41 -050025159 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025160 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050025161 g_value_take_object (value, interface);
25162 break;
25163
Norman James19e45912015-10-04 20:19:41 -050025164 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025165 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050025166 g_value_take_object (value, interface);
25167 break;
25168
Norman James19e45912015-10-04 20:19:41 -050025169 case 8:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025170 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050025171 g_value_take_object (value, interface);
25172 break;
25173
Norman James19e45912015-10-04 20:19:41 -050025174 case 9:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025175 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050025176 g_value_take_object (value, interface);
25177 break;
25178
Norman James19e45912015-10-04 20:19:41 -050025179 case 10:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025180 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050025181 g_value_take_object (value, interface);
25182 break;
25183
Norman James19e45912015-10-04 20:19:41 -050025184 case 11:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025185 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050025186 g_value_take_object (value, interface);
25187 break;
25188
Norman James19e45912015-10-04 20:19:41 -050025189 case 12:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025190 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050025191 g_value_take_object (value, interface);
25192 break;
25193
Norman James19e45912015-10-04 20:19:41 -050025194 case 13:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025195 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050025196 g_value_take_object (value, interface);
25197 break;
25198
Norman James19e45912015-10-04 20:19:41 -050025199 case 14:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025200 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James362a80f2015-09-14 14:04:39 -050025201 g_value_take_object (value, interface);
25202 break;
25203
Norman James19e45912015-10-04 20:19:41 -050025204 case 15:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025205 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25206 g_value_take_object (value, interface);
25207 break;
25208
Norman James19e45912015-10-04 20:19:41 -050025209 case 16:
Norman James362a80f2015-09-14 14:04:39 -050025210 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25211 g_value_take_object (value, interface);
25212 break;
25213
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025214 case 17:
25215 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
25216 g_value_take_object (value, interface);
25217 break;
25218
Norman James362a80f2015-09-14 14:04:39 -050025219 default:
25220 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25221 break;
25222 }
25223}
25224
25225static void
25226object_proxy_class_init (ObjectProxyClass *klass)
25227{
25228 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
25229
25230 gobject_class->set_property = object_proxy_set_property;
25231 gobject_class->get_property = object_proxy_get_property;
25232
25233 g_object_class_override_property (gobject_class, 1, "occ");
25234 g_object_class_override_property (gobject_class, 2, "fan");
25235 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050025236 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
25237 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
25238 g_object_class_override_property (gobject_class, 6, "sensor-match");
25239 g_object_class_override_property (gobject_class, 7, "process");
25240 g_object_class_override_property (gobject_class, 8, "control");
25241 g_object_class_override_property (gobject_class, 9, "control-bmc");
25242 g_object_class_override_property (gobject_class, 10, "control-host");
25243 g_object_class_override_property (gobject_class, 11, "control-power");
25244 g_object_class_override_property (gobject_class, 12, "watchdog");
25245 g_object_class_override_property (gobject_class, 13, "event-log");
25246 g_object_class_override_property (gobject_class, 14, "flash");
25247 g_object_class_override_property (gobject_class, 15, "button");
25248 g_object_class_override_property (gobject_class, 16, "led");
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025249 g_object_class_override_property (gobject_class, 17, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050025250}
25251
25252/**
25253 * object_proxy_new:
25254 * @connection: A #GDBusConnection.
25255 * @object_path: An object path.
25256 *
25257 * Creates a new proxy object.
25258 *
25259 * Returns: (transfer full): The proxy object.
25260 */
25261ObjectProxy *
25262object_proxy_new (GDBusConnection *connection,
25263 const gchar *object_path)
25264{
25265 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
25266 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
25267 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
25268}
25269
25270/**
25271 * ObjectSkeleton:
25272 *
25273 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
25274 */
25275
25276/**
25277 * ObjectSkeletonClass:
25278 * @parent_class: The parent class.
25279 *
25280 * Class structure for #ObjectSkeleton.
25281 */
25282
25283static void
25284object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
25285{
25286}
25287
25288
25289static void
25290object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
25291{
25292 iface->interface_added = object_notify;
25293 iface->interface_removed = object_notify;
25294}
25295
25296G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
25297 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
25298 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
25299
25300static void
25301object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
25302{
25303}
25304
25305static void
25306object_skeleton_set_property (GObject *gobject,
25307 guint prop_id,
25308 const GValue *value,
25309 GParamSpec *pspec)
25310{
25311 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
25312 GDBusInterfaceSkeleton *interface;
25313
25314 switch (prop_id)
25315 {
25316 case 1:
25317 interface = g_value_get_object (value);
25318 if (interface != NULL)
25319 {
25320 g_warn_if_fail (IS_OCC (interface));
25321 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25322 }
25323 else
25324 {
25325 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
25326 }
25327 break;
25328
25329 case 2:
25330 interface = g_value_get_object (value);
25331 if (interface != NULL)
25332 {
25333 g_warn_if_fail (IS_FAN (interface));
25334 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25335 }
25336 else
25337 {
25338 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
25339 }
25340 break;
25341
25342 case 3:
25343 interface = g_value_get_object (value);
25344 if (interface != NULL)
25345 {
25346 g_warn_if_fail (IS_SENSOR_VALUE (interface));
25347 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25348 }
25349 else
25350 {
25351 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
25352 }
25353 break;
25354
25355 case 4:
25356 interface = g_value_get_object (value);
25357 if (interface != NULL)
25358 {
25359 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
25360 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25361 }
25362 else
25363 {
25364 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
25365 }
25366 break;
25367
Norman James19e45912015-10-04 20:19:41 -050025368 case 5:
Norman James362a80f2015-09-14 14:04:39 -050025369 interface = g_value_get_object (value);
25370 if (interface != NULL)
25371 {
25372 g_warn_if_fail (IS_SENSOR_I2C (interface));
25373 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25374 }
25375 else
25376 {
25377 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
25378 }
25379 break;
25380
Norman James19e45912015-10-04 20:19:41 -050025381 case 6:
Norman James362a80f2015-09-14 14:04:39 -050025382 interface = g_value_get_object (value);
25383 if (interface != NULL)
25384 {
25385 g_warn_if_fail (IS_SENSOR_MATCH (interface));
25386 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25387 }
25388 else
25389 {
25390 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
25391 }
25392 break;
25393
Norman James19e45912015-10-04 20:19:41 -050025394 case 7:
Norman James362a80f2015-09-14 14:04:39 -050025395 interface = g_value_get_object (value);
25396 if (interface != NULL)
25397 {
25398 g_warn_if_fail (IS_PROCESS (interface));
25399 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25400 }
25401 else
25402 {
25403 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
25404 }
25405 break;
25406
Norman James19e45912015-10-04 20:19:41 -050025407 case 8:
Norman James362a80f2015-09-14 14:04:39 -050025408 interface = g_value_get_object (value);
25409 if (interface != NULL)
25410 {
25411 g_warn_if_fail (IS_CONTROL (interface));
25412 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25413 }
25414 else
25415 {
25416 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
25417 }
25418 break;
25419
Norman James19e45912015-10-04 20:19:41 -050025420 case 9:
Norman James362a80f2015-09-14 14:04:39 -050025421 interface = g_value_get_object (value);
25422 if (interface != NULL)
25423 {
25424 g_warn_if_fail (IS_CONTROL_BMC (interface));
25425 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25426 }
25427 else
25428 {
25429 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
25430 }
25431 break;
25432
Norman James19e45912015-10-04 20:19:41 -050025433 case 10:
Norman James362a80f2015-09-14 14:04:39 -050025434 interface = g_value_get_object (value);
25435 if (interface != NULL)
25436 {
25437 g_warn_if_fail (IS_CONTROL_HOST (interface));
25438 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25439 }
25440 else
25441 {
25442 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
25443 }
25444 break;
25445
Norman James19e45912015-10-04 20:19:41 -050025446 case 11:
Norman James362a80f2015-09-14 14:04:39 -050025447 interface = g_value_get_object (value);
25448 if (interface != NULL)
25449 {
25450 g_warn_if_fail (IS_CONTROL_POWER (interface));
25451 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25452 }
25453 else
25454 {
25455 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
25456 }
25457 break;
25458
Norman James19e45912015-10-04 20:19:41 -050025459 case 12:
Norman James362a80f2015-09-14 14:04:39 -050025460 interface = g_value_get_object (value);
25461 if (interface != NULL)
25462 {
25463 g_warn_if_fail (IS_WATCHDOG (interface));
25464 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25465 }
25466 else
25467 {
25468 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
25469 }
25470 break;
25471
Norman James19e45912015-10-04 20:19:41 -050025472 case 13:
Norman James362a80f2015-09-14 14:04:39 -050025473 interface = g_value_get_object (value);
25474 if (interface != NULL)
25475 {
25476 g_warn_if_fail (IS_EVENT_LOG (interface));
25477 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25478 }
25479 else
25480 {
25481 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
25482 }
25483 break;
25484
Norman James19e45912015-10-04 20:19:41 -050025485 case 14:
Norman James362a80f2015-09-14 14:04:39 -050025486 interface = g_value_get_object (value);
25487 if (interface != NULL)
25488 {
25489 g_warn_if_fail (IS_FLASH (interface));
25490 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25491 }
25492 else
25493 {
25494 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
25495 }
25496 break;
25497
Norman James19e45912015-10-04 20:19:41 -050025498 case 15:
Norman James362a80f2015-09-14 14:04:39 -050025499 interface = g_value_get_object (value);
25500 if (interface != NULL)
25501 {
25502 g_warn_if_fail (IS_BUTTON (interface));
25503 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25504 }
25505 else
25506 {
25507 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
25508 }
25509 break;
25510
Norman James19e45912015-10-04 20:19:41 -050025511 case 16:
Norman James362a80f2015-09-14 14:04:39 -050025512 interface = g_value_get_object (value);
25513 if (interface != NULL)
25514 {
25515 g_warn_if_fail (IS_LED (interface));
25516 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25517 }
25518 else
25519 {
25520 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
25521 }
25522 break;
25523
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025524 case 17:
25525 interface = g_value_get_object (value);
25526 if (interface != NULL)
25527 {
25528 g_warn_if_fail (IS_HOST_IPMI (interface));
25529 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25530 }
25531 else
25532 {
25533 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
25534 }
25535 break;
25536
Norman James362a80f2015-09-14 14:04:39 -050025537 default:
25538 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25539 break;
25540 }
25541}
25542
25543static void
25544object_skeleton_get_property (GObject *gobject,
25545 guint prop_id,
25546 GValue *value,
25547 GParamSpec *pspec)
25548{
25549 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
25550 GDBusInterface *interface;
25551
25552 switch (prop_id)
25553 {
25554 case 1:
25555 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
25556 g_value_take_object (value, interface);
25557 break;
25558
25559 case 2:
25560 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
25561 g_value_take_object (value, interface);
25562 break;
25563
25564 case 3:
25565 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
25566 g_value_take_object (value, interface);
25567 break;
25568
25569 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025570 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050025571 g_value_take_object (value, interface);
25572 break;
25573
Norman James19e45912015-10-04 20:19:41 -050025574 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025575 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050025576 g_value_take_object (value, interface);
25577 break;
25578
Norman James19e45912015-10-04 20:19:41 -050025579 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025580 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050025581 g_value_take_object (value, interface);
25582 break;
25583
Norman James19e45912015-10-04 20:19:41 -050025584 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025585 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050025586 g_value_take_object (value, interface);
25587 break;
25588
Norman James19e45912015-10-04 20:19:41 -050025589 case 8:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025590 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050025591 g_value_take_object (value, interface);
25592 break;
25593
Norman James19e45912015-10-04 20:19:41 -050025594 case 9:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025595 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050025596 g_value_take_object (value, interface);
25597 break;
25598
Norman James19e45912015-10-04 20:19:41 -050025599 case 10:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025600 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050025601 g_value_take_object (value, interface);
25602 break;
25603
Norman James19e45912015-10-04 20:19:41 -050025604 case 11:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025605 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050025606 g_value_take_object (value, interface);
25607 break;
25608
Norman James19e45912015-10-04 20:19:41 -050025609 case 12:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025610 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050025611 g_value_take_object (value, interface);
25612 break;
25613
Norman James19e45912015-10-04 20:19:41 -050025614 case 13:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025615 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050025616 g_value_take_object (value, interface);
25617 break;
25618
Norman James19e45912015-10-04 20:19:41 -050025619 case 14:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025620 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James362a80f2015-09-14 14:04:39 -050025621 g_value_take_object (value, interface);
25622 break;
25623
Norman James19e45912015-10-04 20:19:41 -050025624 case 15:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025625 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25626 g_value_take_object (value, interface);
25627 break;
25628
Norman James19e45912015-10-04 20:19:41 -050025629 case 16:
Norman James362a80f2015-09-14 14:04:39 -050025630 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25631 g_value_take_object (value, interface);
25632 break;
25633
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025634 case 17:
25635 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
25636 g_value_take_object (value, interface);
25637 break;
25638
Norman James362a80f2015-09-14 14:04:39 -050025639 default:
25640 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25641 break;
25642 }
25643}
25644
25645static void
25646object_skeleton_class_init (ObjectSkeletonClass *klass)
25647{
25648 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
25649
25650 gobject_class->set_property = object_skeleton_set_property;
25651 gobject_class->get_property = object_skeleton_get_property;
25652
25653 g_object_class_override_property (gobject_class, 1, "occ");
25654 g_object_class_override_property (gobject_class, 2, "fan");
25655 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050025656 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
25657 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
25658 g_object_class_override_property (gobject_class, 6, "sensor-match");
25659 g_object_class_override_property (gobject_class, 7, "process");
25660 g_object_class_override_property (gobject_class, 8, "control");
25661 g_object_class_override_property (gobject_class, 9, "control-bmc");
25662 g_object_class_override_property (gobject_class, 10, "control-host");
25663 g_object_class_override_property (gobject_class, 11, "control-power");
25664 g_object_class_override_property (gobject_class, 12, "watchdog");
25665 g_object_class_override_property (gobject_class, 13, "event-log");
25666 g_object_class_override_property (gobject_class, 14, "flash");
25667 g_object_class_override_property (gobject_class, 15, "button");
25668 g_object_class_override_property (gobject_class, 16, "led");
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025669 g_object_class_override_property (gobject_class, 17, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050025670}
25671
25672/**
25673 * object_skeleton_new:
25674 * @object_path: An object path.
25675 *
25676 * Creates a new skeleton object.
25677 *
25678 * Returns: (transfer full): The skeleton object.
25679 */
25680ObjectSkeleton *
25681object_skeleton_new (const gchar *object_path)
25682{
25683 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
25684 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
25685}
25686
25687/**
25688 * object_skeleton_set_occ:
25689 * @object: A #ObjectSkeleton.
25690 * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
25691 *
25692 * 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.
25693 */
25694void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
25695{
25696 g_object_set (G_OBJECT (object), "occ", interface_, NULL);
25697}
25698
25699/**
25700 * object_skeleton_set_fan:
25701 * @object: A #ObjectSkeleton.
25702 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
25703 *
25704 * 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.
25705 */
25706void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
25707{
25708 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
25709}
25710
25711/**
25712 * object_skeleton_set_sensor_value:
25713 * @object: A #ObjectSkeleton.
25714 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
25715 *
25716 * 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.
25717 */
25718void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
25719{
25720 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
25721}
25722
25723/**
25724 * object_skeleton_set_sensor_threshold:
25725 * @object: A #ObjectSkeleton.
25726 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
25727 *
25728 * 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.
25729 */
25730void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
25731{
25732 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
25733}
25734
25735/**
25736 * object_skeleton_set_sensor_i2c:
25737 * @object: A #ObjectSkeleton.
25738 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
25739 *
25740 * 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.
25741 */
25742void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
25743{
25744 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
25745}
25746
25747/**
25748 * object_skeleton_set_sensor_match:
25749 * @object: A #ObjectSkeleton.
25750 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
25751 *
25752 * 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.
25753 */
25754void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
25755{
25756 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
25757}
25758
25759/**
25760 * object_skeleton_set_process:
25761 * @object: A #ObjectSkeleton.
25762 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
25763 *
25764 * 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.
25765 */
25766void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
25767{
25768 g_object_set (G_OBJECT (object), "process", interface_, NULL);
25769}
25770
25771/**
25772 * object_skeleton_set_control:
25773 * @object: A #ObjectSkeleton.
25774 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
25775 *
25776 * 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.
25777 */
25778void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
25779{
25780 g_object_set (G_OBJECT (object), "control", interface_, NULL);
25781}
25782
25783/**
25784 * object_skeleton_set_control_bmc:
25785 * @object: A #ObjectSkeleton.
25786 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
25787 *
25788 * 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.
25789 */
25790void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
25791{
25792 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
25793}
25794
25795/**
25796 * object_skeleton_set_control_host:
25797 * @object: A #ObjectSkeleton.
25798 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
25799 *
25800 * 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.
25801 */
25802void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
25803{
25804 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
25805}
25806
25807/**
25808 * object_skeleton_set_control_power:
25809 * @object: A #ObjectSkeleton.
25810 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
25811 *
25812 * 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.
25813 */
25814void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
25815{
25816 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
25817}
25818
25819/**
25820 * object_skeleton_set_watchdog:
25821 * @object: A #ObjectSkeleton.
25822 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
25823 *
25824 * 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.
25825 */
25826void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
25827{
25828 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
25829}
25830
25831/**
25832 * object_skeleton_set_event_log:
25833 * @object: A #ObjectSkeleton.
25834 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
25835 *
25836 * 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.
25837 */
25838void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
25839{
25840 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
25841}
25842
25843/**
25844 * object_skeleton_set_flash:
25845 * @object: A #ObjectSkeleton.
25846 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
25847 *
25848 * 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.
25849 */
25850void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
25851{
25852 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
25853}
25854
25855/**
25856 * object_skeleton_set_button:
25857 * @object: A #ObjectSkeleton.
25858 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
25859 *
25860 * 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.
25861 */
25862void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
25863{
25864 g_object_set (G_OBJECT (object), "button", interface_, NULL);
25865}
25866
25867/**
25868 * object_skeleton_set_led:
25869 * @object: A #ObjectSkeleton.
25870 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
25871 *
25872 * 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.
25873 */
25874void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
25875{
25876 g_object_set (G_OBJECT (object), "led", interface_, NULL);
25877}
25878
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025879/**
25880 * object_skeleton_set_host_ipmi:
25881 * @object: A #ObjectSkeleton.
25882 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
25883 *
25884 * 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.
25885 */
25886void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
25887{
25888 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
25889}
25890
Norman James362a80f2015-09-14 14:04:39 -050025891
25892/* ------------------------------------------------------------------------
25893 * Code for ObjectManager client
25894 * ------------------------------------------------------------------------
25895 */
25896
25897/**
25898 * SECTION:ObjectManagerClient
25899 * @title: ObjectManagerClient
25900 * @short_description: Generated GDBusObjectManagerClient type
25901 *
25902 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
25903 */
25904
25905/**
25906 * ObjectManagerClient:
25907 *
25908 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
25909 */
25910
25911/**
25912 * ObjectManagerClientClass:
25913 * @parent_class: The parent class.
25914 *
25915 * Class structure for #ObjectManagerClient.
25916 */
25917
25918G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
25919
25920static void
25921object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
25922{
25923}
25924
25925static void
25926object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
25927{
25928}
25929
25930/**
25931 * object_manager_client_get_proxy_type:
25932 * @manager: A #GDBusObjectManagerClient.
25933 * @object_path: The object path of the remote object (unused).
25934 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
25935 * @user_data: User data (unused).
25936 *
25937 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
25938 *
25939 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
25940 */
25941GType
25942object_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)
25943{
25944 static gsize once_init_value = 0;
25945 static GHashTable *lookup_hash;
25946 GType ret;
25947
25948 if (interface_name == NULL)
25949 return TYPE_OBJECT_PROXY;
25950 if (g_once_init_enter (&once_init_value))
25951 {
25952 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
25953 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
25954 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
25955 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050025956 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
25957 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
25958 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
25959 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
25960 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
25961 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
25962 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
25963 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
25964 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
25965 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
25966 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
25967 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
25968 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025969 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050025970 g_once_init_leave (&once_init_value, 1);
25971 }
25972 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
25973 if (ret == (GType) 0)
25974 ret = G_TYPE_DBUS_PROXY;
25975 return ret;
25976}
25977
25978/**
25979 * object_manager_client_new:
25980 * @connection: A #GDBusConnection.
25981 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25982 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25983 * @object_path: An object path.
25984 * @cancellable: (allow-none): A #GCancellable or %NULL.
25985 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25986 * @user_data: User data to pass to @callback.
25987 *
25988 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
25989 *
25990 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25991 * You can then call object_manager_client_new_finish() to get the result of the operation.
25992 *
25993 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
25994 */
25995void
25996object_manager_client_new (
25997 GDBusConnection *connection,
25998 GDBusObjectManagerClientFlags flags,
25999 const gchar *name,
26000 const gchar *object_path,
26001 GCancellable *cancellable,
26002 GAsyncReadyCallback callback,
26003 gpointer user_data)
26004{
26005 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);
26006}
26007
26008/**
26009 * object_manager_client_new_finish:
26010 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
26011 * @error: Return location for error or %NULL
26012 *
26013 * Finishes an operation started with object_manager_client_new().
26014 *
26015 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26016 */
26017GDBusObjectManager *
26018object_manager_client_new_finish (
26019 GAsyncResult *res,
26020 GError **error)
26021{
26022 GObject *ret;
26023 GObject *source_object;
26024 source_object = g_async_result_get_source_object (res);
26025 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26026 g_object_unref (source_object);
26027 if (ret != NULL)
26028 return G_DBUS_OBJECT_MANAGER (ret);
26029 else
26030 return NULL;
26031}
26032
26033/**
26034 * object_manager_client_new_sync:
26035 * @connection: A #GDBusConnection.
26036 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26037 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26038 * @object_path: An object path.
26039 * @cancellable: (allow-none): A #GCancellable or %NULL.
26040 * @error: Return location for error or %NULL
26041 *
26042 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
26043 *
26044 * The calling thread is blocked until a reply is received.
26045 *
26046 * See object_manager_client_new() for the asynchronous version of this constructor.
26047 *
26048 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26049 */
26050GDBusObjectManager *
26051object_manager_client_new_sync (
26052 GDBusConnection *connection,
26053 GDBusObjectManagerClientFlags flags,
26054 const gchar *name,
26055 const gchar *object_path,
26056 GCancellable *cancellable,
26057 GError **error)
26058{
26059 GInitable *ret;
26060 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);
26061 if (ret != NULL)
26062 return G_DBUS_OBJECT_MANAGER (ret);
26063 else
26064 return NULL;
26065}
26066
26067
26068/**
26069 * object_manager_client_new_for_bus:
26070 * @bus_type: A #GBusType.
26071 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26072 * @name: A bus name (well-known or unique).
26073 * @object_path: An object path.
26074 * @cancellable: (allow-none): A #GCancellable or %NULL.
26075 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26076 * @user_data: User data to pass to @callback.
26077 *
26078 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
26079 *
26080 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26081 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
26082 *
26083 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26084 */
26085void
26086object_manager_client_new_for_bus (
26087 GBusType bus_type,
26088 GDBusObjectManagerClientFlags flags,
26089 const gchar *name,
26090 const gchar *object_path,
26091 GCancellable *cancellable,
26092 GAsyncReadyCallback callback,
26093 gpointer user_data)
26094{
26095 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);
26096}
26097
26098/**
26099 * object_manager_client_new_for_bus_finish:
26100 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
26101 * @error: Return location for error or %NULL
26102 *
26103 * Finishes an operation started with object_manager_client_new_for_bus().
26104 *
26105 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26106 */
26107GDBusObjectManager *
26108object_manager_client_new_for_bus_finish (
26109 GAsyncResult *res,
26110 GError **error)
26111{
26112 GObject *ret;
26113 GObject *source_object;
26114 source_object = g_async_result_get_source_object (res);
26115 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26116 g_object_unref (source_object);
26117 if (ret != NULL)
26118 return G_DBUS_OBJECT_MANAGER (ret);
26119 else
26120 return NULL;
26121}
26122
26123/**
26124 * object_manager_client_new_for_bus_sync:
26125 * @bus_type: A #GBusType.
26126 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26127 * @name: A bus name (well-known or unique).
26128 * @object_path: An object path.
26129 * @cancellable: (allow-none): A #GCancellable or %NULL.
26130 * @error: Return location for error or %NULL
26131 *
26132 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26133 *
26134 * The calling thread is blocked until a reply is received.
26135 *
26136 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
26137 *
26138 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26139 */
26140GDBusObjectManager *
26141object_manager_client_new_for_bus_sync (
26142 GBusType bus_type,
26143 GDBusObjectManagerClientFlags flags,
26144 const gchar *name,
26145 const gchar *object_path,
26146 GCancellable *cancellable,
26147 GError **error)
26148{
26149 GInitable *ret;
26150 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);
26151 if (ret != NULL)
26152 return G_DBUS_OBJECT_MANAGER (ret);
26153 else
26154 return NULL;
26155}
26156
26157