blob: fe97149c8cf371cf5bdfcf06c57e5a2e6df52ff8 [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
Norman Jamesf066e872015-10-07 15:29:51 -050018655static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
18656{
18657 {
18658 -1,
18659 (gchar *) "url",
18660 (gchar *) "s",
18661 NULL
18662 },
18663 FALSE
18664};
18665
18666static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
18667{
18668 {
18669 -1,
18670 (gchar *) "filename",
18671 (gchar *) "s",
18672 NULL
18673 },
18674 FALSE
18675};
18676
18677static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
18678{
18679 &_flash_method_info_update_via_tftp_IN_ARG_url,
18680 &_flash_method_info_update_via_tftp_IN_ARG_filename,
18681 NULL
18682};
18683
18684static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
18685{
18686 {
18687 -1,
18688 (gchar *) "updateViaTftp",
18689 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
18690 NULL,
18691 NULL
18692 },
18693 "handle-update-via-tftp",
18694 FALSE
18695};
18696
Norman James362a80f2015-09-14 14:04:39 -050018697static const _ExtendedGDBusMethodInfo _flash_method_info_init =
18698{
18699 {
18700 -1,
18701 (gchar *) "init",
18702 NULL,
18703 NULL,
18704 NULL
18705 },
18706 "handle-init",
18707 FALSE
18708};
18709
18710static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
18711{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018712 &_flash_method_info_update,
Norman Jamesf066e872015-10-07 15:29:51 -050018713 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050018714 &_flash_method_info_init,
18715 NULL
18716};
18717
18718static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
18719{
18720 {
18721 -1,
18722 (gchar *) "Updated",
18723 NULL,
18724 NULL
18725 },
18726 "updated"
18727};
18728
Norman Jamesf066e872015-10-07 15:29:51 -050018729static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
18730{
18731 {
18732 -1,
18733 (gchar *) "url",
18734 (gchar *) "s",
18735 NULL
18736 },
18737 FALSE
18738};
18739
18740static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
18741{
18742 {
18743 -1,
18744 (gchar *) "filename",
18745 (gchar *) "s",
18746 NULL
18747 },
18748 FALSE
18749};
18750
18751static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
18752{
18753 &_flash_signal_info_download_ARG_url,
18754 &_flash_signal_info_download_ARG_filename,
18755 NULL
18756};
18757
18758static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
18759{
18760 {
18761 -1,
18762 (gchar *) "Download",
18763 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
18764 NULL
18765 },
18766 "download"
18767};
18768
Norman James362a80f2015-09-14 14:04:39 -050018769static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
18770{
18771 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050018772 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050018773 NULL
18774};
18775
18776static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
18777{
18778 {
18779 -1,
18780 (gchar *) "org.openbmc.Flash",
18781 (GDBusMethodInfo **) &_flash_method_info_pointers,
18782 (GDBusSignalInfo **) &_flash_signal_info_pointers,
18783 NULL,
18784 NULL
18785 },
18786 "flash",
18787};
18788
18789
18790/**
18791 * flash_interface_info:
18792 *
18793 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
18794 *
18795 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18796 */
18797GDBusInterfaceInfo *
18798flash_interface_info (void)
18799{
18800 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
18801}
18802
18803/**
18804 * flash_override_properties:
18805 * @klass: The class structure for a #GObject<!-- -->-derived class.
18806 * @property_id_begin: The property id to assign to the first overridden property.
18807 *
18808 * Overrides all #GObject properties in the #Flash interface for a concrete class.
18809 * The properties are overridden in the order they are defined.
18810 *
18811 * Returns: The last property id.
18812 */
18813guint
18814flash_override_properties (GObjectClass *klass, guint property_id_begin)
18815{
18816 return property_id_begin - 1;
18817}
18818
18819
18820
18821/**
18822 * Flash:
18823 *
18824 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18825 */
18826
18827/**
18828 * FlashIface:
18829 * @parent_iface: The parent interface.
Norman James362a80f2015-09-14 14:04:39 -050018830 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018831 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050018832 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
18833 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050018834 * @updated: Handler for the #Flash::updated signal.
18835 *
18836 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18837 */
18838
18839typedef FlashIface FlashInterface;
18840G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
18841
18842static void
18843flash_default_init (FlashIface *iface)
18844{
18845 /* GObject signals for incoming D-Bus method calls: */
18846 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018847 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050018848 * @object: A #Flash.
18849 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018850 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050018851 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018852 * 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 -050018853 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018854 * 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 -050018855 *
18856 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18857 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018858 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050018859 G_TYPE_FROM_INTERFACE (iface),
18860 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018861 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050018862 g_signal_accumulator_true_handled,
18863 NULL,
18864 g_cclosure_marshal_generic,
18865 G_TYPE_BOOLEAN,
18866 2,
18867 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
18868
18869 /**
Norman Jamesf066e872015-10-07 15:29:51 -050018870 * Flash::handle-update-via-tftp:
18871 * @object: A #Flash.
18872 * @invocation: A #GDBusMethodInvocation.
18873 * @arg_url: Argument passed by remote caller.
18874 * @arg_filename: Argument passed by remote caller.
18875 *
18876 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
18877 *
18878 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_tftp() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
18879 *
18880 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18881 */
18882 g_signal_new ("handle-update-via-tftp",
18883 G_TYPE_FROM_INTERFACE (iface),
18884 G_SIGNAL_RUN_LAST,
18885 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
18886 g_signal_accumulator_true_handled,
18887 NULL,
18888 g_cclosure_marshal_generic,
18889 G_TYPE_BOOLEAN,
18890 3,
18891 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
18892
18893 /**
Norman James362a80f2015-09-14 14:04:39 -050018894 * Flash::handle-init:
18895 * @object: A #Flash.
18896 * @invocation: A #GDBusMethodInvocation.
18897 *
18898 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
18899 *
18900 * 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.
18901 *
18902 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18903 */
18904 g_signal_new ("handle-init",
18905 G_TYPE_FROM_INTERFACE (iface),
18906 G_SIGNAL_RUN_LAST,
18907 G_STRUCT_OFFSET (FlashIface, handle_init),
18908 g_signal_accumulator_true_handled,
18909 NULL,
18910 g_cclosure_marshal_generic,
18911 G_TYPE_BOOLEAN,
18912 1,
18913 G_TYPE_DBUS_METHOD_INVOCATION);
18914
18915 /* GObject signals for received D-Bus signals: */
18916 /**
18917 * Flash::updated:
18918 * @object: A #Flash.
18919 *
18920 * 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.
18921 *
18922 * 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.
18923 */
18924 g_signal_new ("updated",
18925 G_TYPE_FROM_INTERFACE (iface),
18926 G_SIGNAL_RUN_LAST,
18927 G_STRUCT_OFFSET (FlashIface, updated),
18928 NULL,
18929 NULL,
18930 g_cclosure_marshal_generic,
18931 G_TYPE_NONE,
18932 0);
18933
Norman Jamesf066e872015-10-07 15:29:51 -050018934 /**
18935 * Flash::download:
18936 * @object: A #Flash.
18937 * @arg_url: Argument.
18938 * @arg_filename: Argument.
18939 *
18940 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> is received.
18941 *
18942 * 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.
18943 */
18944 g_signal_new ("download",
18945 G_TYPE_FROM_INTERFACE (iface),
18946 G_SIGNAL_RUN_LAST,
18947 G_STRUCT_OFFSET (FlashIface, download),
18948 NULL,
18949 NULL,
18950 g_cclosure_marshal_generic,
18951 G_TYPE_NONE,
18952 2, G_TYPE_STRING, G_TYPE_STRING);
18953
Norman James362a80f2015-09-14 14:04:39 -050018954}
18955
18956/**
18957 * flash_emit_updated:
18958 * @object: A #Flash.
18959 *
18960 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
18961 */
18962void
18963flash_emit_updated (
18964 Flash *object)
18965{
18966 g_signal_emit_by_name (object, "updated");
18967}
18968
18969/**
Norman Jamesf066e872015-10-07 15:29:51 -050018970 * flash_emit_download:
18971 * @object: A #Flash.
18972 * @arg_url: Argument to pass with the signal.
18973 * @arg_filename: Argument to pass with the signal.
18974 *
18975 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
18976 */
18977void
18978flash_emit_download (
18979 Flash *object,
18980 const gchar *arg_url,
18981 const gchar *arg_filename)
18982{
18983 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
18984}
18985
18986/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018987 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050018988 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018989 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050018990 * @cancellable: (allow-none): A #GCancellable or %NULL.
18991 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18992 * @user_data: User data to pass to @callback.
18993 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018994 * 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 -050018995 * When the operation is finished, @callback will be invoked 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 -050018996 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050018997 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018998 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050018999 */
19000void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019001flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050019002 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019003 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050019004 GCancellable *cancellable,
19005 GAsyncReadyCallback callback,
19006 gpointer user_data)
19007{
19008 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019009 "update",
Norman James362a80f2015-09-14 14:04:39 -050019010 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019011 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050019012 G_DBUS_CALL_FLAGS_NONE,
19013 -1,
19014 cancellable,
19015 callback,
19016 user_data);
19017}
19018
19019/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019020 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050019021 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019022 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050019023 * @error: Return location for error or %NULL.
19024 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019025 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050019026 *
19027 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19028 */
19029gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019030flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050019031 Flash *proxy,
19032 GAsyncResult *res,
19033 GError **error)
19034{
19035 GVariant *_ret;
19036 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19037 if (_ret == NULL)
19038 goto _out;
19039 g_variant_get (_ret,
19040 "()");
19041 g_variant_unref (_ret);
19042_out:
19043 return _ret != NULL;
19044}
19045
19046/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019047 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050019048 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019049 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050019050 * @cancellable: (allow-none): A #GCancellable or %NULL.
19051 * @error: Return location for error or %NULL.
19052 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019053 * 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 -050019054 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019055 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050019056 *
19057 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19058 */
19059gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019060flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050019061 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019062 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050019063 GCancellable *cancellable,
19064 GError **error)
19065{
19066 GVariant *_ret;
19067 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019068 "update",
Norman James362a80f2015-09-14 14:04:39 -050019069 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019070 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050019071 G_DBUS_CALL_FLAGS_NONE,
19072 -1,
19073 cancellable,
19074 error);
19075 if (_ret == NULL)
19076 goto _out;
19077 g_variant_get (_ret,
19078 "()");
19079 g_variant_unref (_ret);
19080_out:
19081 return _ret != NULL;
19082}
19083
19084/**
Norman Jamesf066e872015-10-07 15:29:51 -050019085 * flash_call_update_via_tftp:
19086 * @proxy: A #FlashProxy.
19087 * @arg_url: Argument to pass with the method invocation.
19088 * @arg_filename: Argument to pass with the method invocation.
19089 * @cancellable: (allow-none): A #GCancellable or %NULL.
19090 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19091 * @user_data: User data to pass to @callback.
19092 *
19093 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
19094 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19095 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
19096 *
19097 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
19098 */
19099void
19100flash_call_update_via_tftp (
19101 Flash *proxy,
19102 const gchar *arg_url,
19103 const gchar *arg_filename,
19104 GCancellable *cancellable,
19105 GAsyncReadyCallback callback,
19106 gpointer user_data)
19107{
19108 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19109 "updateViaTftp",
19110 g_variant_new ("(ss)",
19111 arg_url,
19112 arg_filename),
19113 G_DBUS_CALL_FLAGS_NONE,
19114 -1,
19115 cancellable,
19116 callback,
19117 user_data);
19118}
19119
19120/**
19121 * flash_call_update_via_tftp_finish:
19122 * @proxy: A #FlashProxy.
19123 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
19124 * @error: Return location for error or %NULL.
19125 *
19126 * Finishes an operation started with flash_call_update_via_tftp().
19127 *
19128 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19129 */
19130gboolean
19131flash_call_update_via_tftp_finish (
19132 Flash *proxy,
19133 GAsyncResult *res,
19134 GError **error)
19135{
19136 GVariant *_ret;
19137 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19138 if (_ret == NULL)
19139 goto _out;
19140 g_variant_get (_ret,
19141 "()");
19142 g_variant_unref (_ret);
19143_out:
19144 return _ret != NULL;
19145}
19146
19147/**
19148 * flash_call_update_via_tftp_sync:
19149 * @proxy: A #FlashProxy.
19150 * @arg_url: Argument to pass with the method invocation.
19151 * @arg_filename: Argument to pass with the method invocation.
19152 * @cancellable: (allow-none): A #GCancellable or %NULL.
19153 * @error: Return location for error or %NULL.
19154 *
19155 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
19156 *
19157 * See flash_call_update_via_tftp() for the asynchronous version of this method.
19158 *
19159 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19160 */
19161gboolean
19162flash_call_update_via_tftp_sync (
19163 Flash *proxy,
19164 const gchar *arg_url,
19165 const gchar *arg_filename,
19166 GCancellable *cancellable,
19167 GError **error)
19168{
19169 GVariant *_ret;
19170 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19171 "updateViaTftp",
19172 g_variant_new ("(ss)",
19173 arg_url,
19174 arg_filename),
19175 G_DBUS_CALL_FLAGS_NONE,
19176 -1,
19177 cancellable,
19178 error);
19179 if (_ret == NULL)
19180 goto _out;
19181 g_variant_get (_ret,
19182 "()");
19183 g_variant_unref (_ret);
19184_out:
19185 return _ret != NULL;
19186}
19187
19188/**
Norman James362a80f2015-09-14 14:04:39 -050019189 * flash_call_init:
19190 * @proxy: A #FlashProxy.
19191 * @cancellable: (allow-none): A #GCancellable or %NULL.
19192 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19193 * @user_data: User data to pass to @callback.
19194 *
19195 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
19196 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19197 * You can then call flash_call_init_finish() to get the result of the operation.
19198 *
19199 * See flash_call_init_sync() for the synchronous, blocking version of this method.
19200 */
19201void
19202flash_call_init (
19203 Flash *proxy,
19204 GCancellable *cancellable,
19205 GAsyncReadyCallback callback,
19206 gpointer user_data)
19207{
19208 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19209 "init",
19210 g_variant_new ("()"),
19211 G_DBUS_CALL_FLAGS_NONE,
19212 -1,
19213 cancellable,
19214 callback,
19215 user_data);
19216}
19217
19218/**
19219 * flash_call_init_finish:
19220 * @proxy: A #FlashProxy.
19221 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
19222 * @error: Return location for error or %NULL.
19223 *
19224 * Finishes an operation started with flash_call_init().
19225 *
19226 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19227 */
19228gboolean
19229flash_call_init_finish (
19230 Flash *proxy,
19231 GAsyncResult *res,
19232 GError **error)
19233{
19234 GVariant *_ret;
19235 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19236 if (_ret == NULL)
19237 goto _out;
19238 g_variant_get (_ret,
19239 "()");
19240 g_variant_unref (_ret);
19241_out:
19242 return _ret != NULL;
19243}
19244
19245/**
19246 * flash_call_init_sync:
19247 * @proxy: A #FlashProxy.
19248 * @cancellable: (allow-none): A #GCancellable or %NULL.
19249 * @error: Return location for error or %NULL.
19250 *
19251 * 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.
19252 *
19253 * See flash_call_init() for the asynchronous version of this method.
19254 *
19255 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19256 */
19257gboolean
19258flash_call_init_sync (
19259 Flash *proxy,
19260 GCancellable *cancellable,
19261 GError **error)
19262{
19263 GVariant *_ret;
19264 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19265 "init",
19266 g_variant_new ("()"),
19267 G_DBUS_CALL_FLAGS_NONE,
19268 -1,
19269 cancellable,
19270 error);
19271 if (_ret == NULL)
19272 goto _out;
19273 g_variant_get (_ret,
19274 "()");
19275 g_variant_unref (_ret);
19276_out:
19277 return _ret != NULL;
19278}
19279
19280/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019281 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050019282 * @object: A #Flash.
19283 * @invocation: (transfer full): A #GDBusMethodInvocation.
19284 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019285 * 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 -050019286 *
19287 * This method will free @invocation, you cannot use it afterwards.
19288 */
19289void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019290flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050019291 Flash *object,
19292 GDBusMethodInvocation *invocation)
19293{
19294 g_dbus_method_invocation_return_value (invocation,
19295 g_variant_new ("()"));
19296}
19297
19298/**
Norman Jamesf066e872015-10-07 15:29:51 -050019299 * flash_complete_update_via_tftp:
19300 * @object: A #Flash.
19301 * @invocation: (transfer full): A #GDBusMethodInvocation.
19302 *
19303 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
19304 *
19305 * This method will free @invocation, you cannot use it afterwards.
19306 */
19307void
19308flash_complete_update_via_tftp (
19309 Flash *object,
19310 GDBusMethodInvocation *invocation)
19311{
19312 g_dbus_method_invocation_return_value (invocation,
19313 g_variant_new ("()"));
19314}
19315
19316/**
Norman James362a80f2015-09-14 14:04:39 -050019317 * flash_complete_init:
19318 * @object: A #Flash.
19319 * @invocation: (transfer full): A #GDBusMethodInvocation.
19320 *
19321 * 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.
19322 *
19323 * This method will free @invocation, you cannot use it afterwards.
19324 */
19325void
19326flash_complete_init (
19327 Flash *object,
19328 GDBusMethodInvocation *invocation)
19329{
19330 g_dbus_method_invocation_return_value (invocation,
19331 g_variant_new ("()"));
19332}
19333
19334/* ------------------------------------------------------------------------ */
19335
19336/**
19337 * FlashProxy:
19338 *
19339 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
19340 */
19341
19342/**
19343 * FlashProxyClass:
19344 * @parent_class: The parent class.
19345 *
19346 * Class structure for #FlashProxy.
19347 */
19348
19349struct _FlashProxyPrivate
19350{
19351 GData *qdata;
19352};
19353
19354static void flash_proxy_iface_init (FlashIface *iface);
19355
19356#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19357G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19358 G_ADD_PRIVATE (FlashProxy)
19359 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19360
19361#else
19362G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19363 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19364
19365#endif
19366static void
19367flash_proxy_finalize (GObject *object)
19368{
19369 FlashProxy *proxy = FLASH_PROXY (object);
19370 g_datalist_clear (&proxy->priv->qdata);
19371 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
19372}
19373
19374static void
19375flash_proxy_get_property (GObject *object,
19376 guint prop_id,
19377 GValue *value,
19378 GParamSpec *pspec G_GNUC_UNUSED)
19379{
19380}
19381
19382static void
19383flash_proxy_set_property (GObject *object,
19384 guint prop_id,
19385 const GValue *value,
19386 GParamSpec *pspec G_GNUC_UNUSED)
19387{
19388}
19389
19390static void
19391flash_proxy_g_signal (GDBusProxy *proxy,
19392 const gchar *sender_name G_GNUC_UNUSED,
19393 const gchar *signal_name,
19394 GVariant *parameters)
19395{
19396 _ExtendedGDBusSignalInfo *info;
19397 GVariantIter iter;
19398 GVariant *child;
19399 GValue *paramv;
19400 guint num_params;
19401 guint n;
19402 guint signal_id;
19403 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
19404 if (info == NULL)
19405 return;
19406 num_params = g_variant_n_children (parameters);
19407 paramv = g_new0 (GValue, num_params + 1);
19408 g_value_init (&paramv[0], TYPE_FLASH);
19409 g_value_set_object (&paramv[0], proxy);
19410 g_variant_iter_init (&iter, parameters);
19411 n = 1;
19412 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19413 {
19414 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19415 if (arg_info->use_gvariant)
19416 {
19417 g_value_init (&paramv[n], G_TYPE_VARIANT);
19418 g_value_set_variant (&paramv[n], child);
19419 n++;
19420 }
19421 else
19422 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19423 g_variant_unref (child);
19424 }
19425 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19426 g_signal_emitv (paramv, signal_id, 0, NULL);
19427 for (n = 0; n < num_params + 1; n++)
19428 g_value_unset (&paramv[n]);
19429 g_free (paramv);
19430}
19431
19432static void
19433flash_proxy_g_properties_changed (GDBusProxy *_proxy,
19434 GVariant *changed_properties,
19435 const gchar *const *invalidated_properties)
19436{
19437 FlashProxy *proxy = FLASH_PROXY (_proxy);
19438 guint n;
19439 const gchar *key;
19440 GVariantIter *iter;
19441 _ExtendedGDBusPropertyInfo *info;
19442 g_variant_get (changed_properties, "a{sv}", &iter);
19443 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19444 {
19445 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
19446 g_datalist_remove_data (&proxy->priv->qdata, key);
19447 if (info != NULL)
19448 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19449 }
19450 g_variant_iter_free (iter);
19451 for (n = 0; invalidated_properties[n] != NULL; n++)
19452 {
19453 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
19454 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19455 if (info != NULL)
19456 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19457 }
19458}
19459
19460static void
19461flash_proxy_init (FlashProxy *proxy)
19462{
19463#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19464 proxy->priv = flash_proxy_get_instance_private (proxy);
19465#else
19466 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
19467#endif
19468
19469 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
19470}
19471
19472static void
19473flash_proxy_class_init (FlashProxyClass *klass)
19474{
19475 GObjectClass *gobject_class;
19476 GDBusProxyClass *proxy_class;
19477
19478 gobject_class = G_OBJECT_CLASS (klass);
19479 gobject_class->finalize = flash_proxy_finalize;
19480 gobject_class->get_property = flash_proxy_get_property;
19481 gobject_class->set_property = flash_proxy_set_property;
19482
19483 proxy_class = G_DBUS_PROXY_CLASS (klass);
19484 proxy_class->g_signal = flash_proxy_g_signal;
19485 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
19486
19487#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19488 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
19489#endif
19490}
19491
19492static void
19493flash_proxy_iface_init (FlashIface *iface)
19494{
19495}
19496
19497/**
19498 * flash_proxy_new:
19499 * @connection: A #GDBusConnection.
19500 * @flags: Flags from the #GDBusProxyFlags enumeration.
19501 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19502 * @object_path: An object path.
19503 * @cancellable: (allow-none): A #GCancellable or %NULL.
19504 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19505 * @user_data: User data to pass to @callback.
19506 *
19507 * 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.
19508 *
19509 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19510 * You can then call flash_proxy_new_finish() to get the result of the operation.
19511 *
19512 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
19513 */
19514void
19515flash_proxy_new (
19516 GDBusConnection *connection,
19517 GDBusProxyFlags flags,
19518 const gchar *name,
19519 const gchar *object_path,
19520 GCancellable *cancellable,
19521 GAsyncReadyCallback callback,
19522 gpointer user_data)
19523{
19524 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);
19525}
19526
19527/**
19528 * flash_proxy_new_finish:
19529 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
19530 * @error: Return location for error or %NULL
19531 *
19532 * Finishes an operation started with flash_proxy_new().
19533 *
19534 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19535 */
19536Flash *
19537flash_proxy_new_finish (
19538 GAsyncResult *res,
19539 GError **error)
19540{
19541 GObject *ret;
19542 GObject *source_object;
19543 source_object = g_async_result_get_source_object (res);
19544 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19545 g_object_unref (source_object);
19546 if (ret != NULL)
19547 return FLASH (ret);
19548 else
19549 return NULL;
19550}
19551
19552/**
19553 * flash_proxy_new_sync:
19554 * @connection: A #GDBusConnection.
19555 * @flags: Flags from the #GDBusProxyFlags enumeration.
19556 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19557 * @object_path: An object path.
19558 * @cancellable: (allow-none): A #GCancellable or %NULL.
19559 * @error: Return location for error or %NULL
19560 *
19561 * 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.
19562 *
19563 * The calling thread is blocked until a reply is received.
19564 *
19565 * See flash_proxy_new() for the asynchronous version of this constructor.
19566 *
19567 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19568 */
19569Flash *
19570flash_proxy_new_sync (
19571 GDBusConnection *connection,
19572 GDBusProxyFlags flags,
19573 const gchar *name,
19574 const gchar *object_path,
19575 GCancellable *cancellable,
19576 GError **error)
19577{
19578 GInitable *ret;
19579 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);
19580 if (ret != NULL)
19581 return FLASH (ret);
19582 else
19583 return NULL;
19584}
19585
19586
19587/**
19588 * flash_proxy_new_for_bus:
19589 * @bus_type: A #GBusType.
19590 * @flags: Flags from the #GDBusProxyFlags enumeration.
19591 * @name: A bus name (well-known or unique).
19592 * @object_path: An object path.
19593 * @cancellable: (allow-none): A #GCancellable or %NULL.
19594 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19595 * @user_data: User data to pass to @callback.
19596 *
19597 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19598 *
19599 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19600 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
19601 *
19602 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19603 */
19604void
19605flash_proxy_new_for_bus (
19606 GBusType bus_type,
19607 GDBusProxyFlags flags,
19608 const gchar *name,
19609 const gchar *object_path,
19610 GCancellable *cancellable,
19611 GAsyncReadyCallback callback,
19612 gpointer user_data)
19613{
19614 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);
19615}
19616
19617/**
19618 * flash_proxy_new_for_bus_finish:
19619 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
19620 * @error: Return location for error or %NULL
19621 *
19622 * Finishes an operation started with flash_proxy_new_for_bus().
19623 *
19624 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19625 */
19626Flash *
19627flash_proxy_new_for_bus_finish (
19628 GAsyncResult *res,
19629 GError **error)
19630{
19631 GObject *ret;
19632 GObject *source_object;
19633 source_object = g_async_result_get_source_object (res);
19634 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19635 g_object_unref (source_object);
19636 if (ret != NULL)
19637 return FLASH (ret);
19638 else
19639 return NULL;
19640}
19641
19642/**
19643 * flash_proxy_new_for_bus_sync:
19644 * @bus_type: A #GBusType.
19645 * @flags: Flags from the #GDBusProxyFlags enumeration.
19646 * @name: A bus name (well-known or unique).
19647 * @object_path: An object path.
19648 * @cancellable: (allow-none): A #GCancellable or %NULL.
19649 * @error: Return location for error or %NULL
19650 *
19651 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19652 *
19653 * The calling thread is blocked until a reply is received.
19654 *
19655 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
19656 *
19657 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19658 */
19659Flash *
19660flash_proxy_new_for_bus_sync (
19661 GBusType bus_type,
19662 GDBusProxyFlags flags,
19663 const gchar *name,
19664 const gchar *object_path,
19665 GCancellable *cancellable,
19666 GError **error)
19667{
19668 GInitable *ret;
19669 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);
19670 if (ret != NULL)
19671 return FLASH (ret);
19672 else
19673 return NULL;
19674}
19675
19676
19677/* ------------------------------------------------------------------------ */
19678
19679/**
19680 * FlashSkeleton:
19681 *
19682 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
19683 */
19684
19685/**
19686 * FlashSkeletonClass:
19687 * @parent_class: The parent class.
19688 *
19689 * Class structure for #FlashSkeleton.
19690 */
19691
19692struct _FlashSkeletonPrivate
19693{
19694 GValue *properties;
19695 GList *changed_properties;
19696 GSource *changed_properties_idle_source;
19697 GMainContext *context;
19698 GMutex lock;
19699};
19700
19701static void
19702_flash_skeleton_handle_method_call (
19703 GDBusConnection *connection G_GNUC_UNUSED,
19704 const gchar *sender G_GNUC_UNUSED,
19705 const gchar *object_path G_GNUC_UNUSED,
19706 const gchar *interface_name,
19707 const gchar *method_name,
19708 GVariant *parameters,
19709 GDBusMethodInvocation *invocation,
19710 gpointer user_data)
19711{
19712 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19713 _ExtendedGDBusMethodInfo *info;
19714 GVariantIter iter;
19715 GVariant *child;
19716 GValue *paramv;
19717 guint num_params;
19718 guint num_extra;
19719 guint n;
19720 guint signal_id;
19721 GValue return_value = G_VALUE_INIT;
19722 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19723 g_assert (info != NULL);
19724 num_params = g_variant_n_children (parameters);
19725 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19726 n = 0;
19727 g_value_init (&paramv[n], TYPE_FLASH);
19728 g_value_set_object (&paramv[n++], skeleton);
19729 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19730 g_value_set_object (&paramv[n++], invocation);
19731 if (info->pass_fdlist)
19732 {
19733#ifdef G_OS_UNIX
19734 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19735 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19736#else
19737 g_assert_not_reached ();
19738#endif
19739 }
19740 g_variant_iter_init (&iter, parameters);
19741 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19742 {
19743 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19744 if (arg_info->use_gvariant)
19745 {
19746 g_value_init (&paramv[n], G_TYPE_VARIANT);
19747 g_value_set_variant (&paramv[n], child);
19748 n++;
19749 }
19750 else
19751 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19752 g_variant_unref (child);
19753 }
19754 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19755 g_value_init (&return_value, G_TYPE_BOOLEAN);
19756 g_signal_emitv (paramv, signal_id, 0, &return_value);
19757 if (!g_value_get_boolean (&return_value))
19758 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);
19759 g_value_unset (&return_value);
19760 for (n = 0; n < num_params + num_extra; n++)
19761 g_value_unset (&paramv[n]);
19762 g_free (paramv);
19763}
19764
19765static GVariant *
19766_flash_skeleton_handle_get_property (
19767 GDBusConnection *connection G_GNUC_UNUSED,
19768 const gchar *sender G_GNUC_UNUSED,
19769 const gchar *object_path G_GNUC_UNUSED,
19770 const gchar *interface_name G_GNUC_UNUSED,
19771 const gchar *property_name,
19772 GError **error,
19773 gpointer user_data)
19774{
19775 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19776 GValue value = G_VALUE_INIT;
19777 GParamSpec *pspec;
19778 _ExtendedGDBusPropertyInfo *info;
19779 GVariant *ret;
19780 ret = NULL;
19781 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
19782 g_assert (info != NULL);
19783 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19784 if (pspec == NULL)
19785 {
19786 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19787 }
19788 else
19789 {
19790 g_value_init (&value, pspec->value_type);
19791 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19792 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19793 g_value_unset (&value);
19794 }
19795 return ret;
19796}
19797
19798static gboolean
19799_flash_skeleton_handle_set_property (
19800 GDBusConnection *connection G_GNUC_UNUSED,
19801 const gchar *sender G_GNUC_UNUSED,
19802 const gchar *object_path G_GNUC_UNUSED,
19803 const gchar *interface_name G_GNUC_UNUSED,
19804 const gchar *property_name,
19805 GVariant *variant,
19806 GError **error,
19807 gpointer user_data)
19808{
19809 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19810 GValue value = G_VALUE_INIT;
19811 GParamSpec *pspec;
19812 _ExtendedGDBusPropertyInfo *info;
19813 gboolean ret;
19814 ret = FALSE;
19815 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
19816 g_assert (info != NULL);
19817 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19818 if (pspec == NULL)
19819 {
19820 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19821 }
19822 else
19823 {
19824 if (info->use_gvariant)
19825 g_value_set_variant (&value, variant);
19826 else
19827 g_dbus_gvariant_to_gvalue (variant, &value);
19828 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19829 g_value_unset (&value);
19830 ret = TRUE;
19831 }
19832 return ret;
19833}
19834
19835static const GDBusInterfaceVTable _flash_skeleton_vtable =
19836{
19837 _flash_skeleton_handle_method_call,
19838 _flash_skeleton_handle_get_property,
19839 _flash_skeleton_handle_set_property,
19840 {NULL}
19841};
19842
19843static GDBusInterfaceInfo *
19844flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19845{
19846 return flash_interface_info ();
19847}
19848
19849static GDBusInterfaceVTable *
19850flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19851{
19852 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
19853}
19854
19855static GVariant *
19856flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19857{
19858 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
19859
19860 GVariantBuilder builder;
19861 guint n;
19862 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19863 if (_flash_interface_info.parent_struct.properties == NULL)
19864 goto out;
19865 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
19866 {
19867 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
19868 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19869 {
19870 GVariant *value;
19871 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);
19872 if (value != NULL)
19873 {
19874 g_variant_take_ref (value);
19875 g_variant_builder_add (&builder, "{sv}", info->name, value);
19876 g_variant_unref (value);
19877 }
19878 }
19879 }
19880out:
19881 return g_variant_builder_end (&builder);
19882}
19883
19884static void
19885flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
19886{
19887}
19888
19889static void
19890_flash_on_signal_updated (
19891 Flash *object)
19892{
19893 FlashSkeleton *skeleton = FLASH_SKELETON (object);
19894
19895 GList *connections, *l;
19896 GVariant *signal_variant;
19897 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19898
19899 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
19900 for (l = connections; l != NULL; l = l->next)
19901 {
19902 GDBusConnection *connection = l->data;
19903 g_dbus_connection_emit_signal (connection,
19904 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
19905 signal_variant, NULL);
19906 }
19907 g_variant_unref (signal_variant);
19908 g_list_free_full (connections, g_object_unref);
19909}
19910
Norman Jamesf066e872015-10-07 15:29:51 -050019911static void
19912_flash_on_signal_download (
19913 Flash *object,
19914 const gchar *arg_url,
19915 const gchar *arg_filename)
19916{
19917 FlashSkeleton *skeleton = FLASH_SKELETON (object);
19918
19919 GList *connections, *l;
19920 GVariant *signal_variant;
19921 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19922
19923 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
19924 arg_url,
19925 arg_filename));
19926 for (l = connections; l != NULL; l = l->next)
19927 {
19928 GDBusConnection *connection = l->data;
19929 g_dbus_connection_emit_signal (connection,
19930 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
19931 signal_variant, NULL);
19932 }
19933 g_variant_unref (signal_variant);
19934 g_list_free_full (connections, g_object_unref);
19935}
19936
Norman James362a80f2015-09-14 14:04:39 -050019937static void flash_skeleton_iface_init (FlashIface *iface);
19938#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19939G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19940 G_ADD_PRIVATE (FlashSkeleton)
19941 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
19942
19943#else
19944G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19945 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
19946
19947#endif
19948static void
19949flash_skeleton_finalize (GObject *object)
19950{
19951 FlashSkeleton *skeleton = FLASH_SKELETON (object);
19952 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19953 if (skeleton->priv->changed_properties_idle_source != NULL)
19954 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19955 g_main_context_unref (skeleton->priv->context);
19956 g_mutex_clear (&skeleton->priv->lock);
19957 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
19958}
19959
19960static void
19961flash_skeleton_init (FlashSkeleton *skeleton)
19962{
19963#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19964 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
19965#else
19966 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
19967#endif
19968
19969 g_mutex_init (&skeleton->priv->lock);
19970 skeleton->priv->context = g_main_context_ref_thread_default ();
19971}
19972
19973static void
19974flash_skeleton_class_init (FlashSkeletonClass *klass)
19975{
19976 GObjectClass *gobject_class;
19977 GDBusInterfaceSkeletonClass *skeleton_class;
19978
19979 gobject_class = G_OBJECT_CLASS (klass);
19980 gobject_class->finalize = flash_skeleton_finalize;
19981
19982 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
19983 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
19984 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
19985 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
19986 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
19987
19988#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19989 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
19990#endif
19991}
19992
19993static void
19994flash_skeleton_iface_init (FlashIface *iface)
19995{
19996 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050019997 iface->download = _flash_on_signal_download;
Norman James362a80f2015-09-14 14:04:39 -050019998}
19999
20000/**
20001 * flash_skeleton_new:
20002 *
20003 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20004 *
20005 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
20006 */
20007Flash *
20008flash_skeleton_new (void)
20009{
20010 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
20011}
20012
20013/* ------------------------------------------------------------------------
20014 * Code for interface org.openbmc.Button
20015 * ------------------------------------------------------------------------
20016 */
20017
20018/**
20019 * SECTION:Button
20020 * @title: Button
20021 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
20022 *
20023 * 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.
20024 */
20025
20026/* ---- Introspection data for org.openbmc.Button ---- */
20027
20028static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
20029{
20030 {
20031 -1,
20032 (gchar *) "state",
20033 (gchar *) "b",
20034 NULL
20035 },
20036 FALSE
20037};
20038
20039static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
20040{
20041 &_button_method_info_is_on_OUT_ARG_state,
20042 NULL
20043};
20044
20045static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
20046{
20047 {
20048 -1,
20049 (gchar *) "isOn",
20050 NULL,
20051 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
20052 NULL
20053 },
20054 "handle-is-on",
20055 FALSE
20056};
20057
20058static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
20059{
20060 {
20061 -1,
20062 (gchar *) "simButtonPress",
20063 NULL,
20064 NULL,
20065 NULL
20066 },
20067 "handle-sim-button-press",
20068 FALSE
20069};
20070
20071static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
20072{
20073 {
20074 -1,
20075 (gchar *) "simButtonLongPress",
20076 NULL,
20077 NULL,
20078 NULL
20079 },
20080 "handle-sim-button-long-press",
20081 FALSE
20082};
20083
20084static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
20085{
20086 &_button_method_info_is_on,
20087 &_button_method_info_sim_button_press,
20088 &_button_method_info_sim_button_long_press,
20089 NULL
20090};
20091
20092static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
20093{
20094 {
20095 -1,
20096 (gchar *) "ButtonRelease",
20097 NULL,
20098 NULL
20099 },
20100 "button-release"
20101};
20102
20103static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
20104{
20105 {
20106 -1,
20107 (gchar *) "ButtonPressed",
20108 NULL,
20109 NULL
20110 },
20111 "button-pressed"
20112};
20113
20114static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
20115{
20116 {
20117 -1,
20118 (gchar *) "ButtonPressedLong",
20119 NULL,
20120 NULL
20121 },
20122 "button-pressed-long"
20123};
20124
20125static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
20126{
20127 &_button_signal_info_button_release,
20128 &_button_signal_info_button_pressed,
20129 &_button_signal_info_button_pressed_long,
20130 NULL
20131};
20132
20133static const _ExtendedGDBusPropertyInfo _button_property_info_state =
20134{
20135 {
20136 -1,
20137 (gchar *) "state",
20138 (gchar *) "b",
20139 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20140 NULL
20141 },
20142 "state",
20143 FALSE
20144};
20145
20146static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
20147{
20148 &_button_property_info_state,
20149 NULL
20150};
20151
20152static const _ExtendedGDBusInterfaceInfo _button_interface_info =
20153{
20154 {
20155 -1,
20156 (gchar *) "org.openbmc.Button",
20157 (GDBusMethodInfo **) &_button_method_info_pointers,
20158 (GDBusSignalInfo **) &_button_signal_info_pointers,
20159 (GDBusPropertyInfo **) &_button_property_info_pointers,
20160 NULL
20161 },
20162 "button",
20163};
20164
20165
20166/**
20167 * button_interface_info:
20168 *
20169 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
20170 *
20171 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20172 */
20173GDBusInterfaceInfo *
20174button_interface_info (void)
20175{
20176 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
20177}
20178
20179/**
20180 * button_override_properties:
20181 * @klass: The class structure for a #GObject<!-- -->-derived class.
20182 * @property_id_begin: The property id to assign to the first overridden property.
20183 *
20184 * Overrides all #GObject properties in the #Button interface for a concrete class.
20185 * The properties are overridden in the order they are defined.
20186 *
20187 * Returns: The last property id.
20188 */
20189guint
20190button_override_properties (GObjectClass *klass, guint property_id_begin)
20191{
20192 g_object_class_override_property (klass, property_id_begin++, "state");
20193 return property_id_begin - 1;
20194}
20195
20196
20197
20198/**
20199 * Button:
20200 *
20201 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
20202 */
20203
20204/**
20205 * ButtonIface:
20206 * @parent_iface: The parent interface.
20207 * @handle_is_on: Handler for the #Button::handle-is-on signal.
20208 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
20209 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
20210 * @get_state: Getter for the #Button:state property.
20211 * @button_pressed: Handler for the #Button::button-pressed signal.
20212 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
20213 * @button_release: Handler for the #Button::button-release signal.
20214 *
20215 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
20216 */
20217
20218typedef ButtonIface ButtonInterface;
20219G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
20220
20221static void
20222button_default_init (ButtonIface *iface)
20223{
20224 /* GObject signals for incoming D-Bus method calls: */
20225 /**
20226 * Button::handle-is-on:
20227 * @object: A #Button.
20228 * @invocation: A #GDBusMethodInvocation.
20229 *
20230 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
20231 *
20232 * 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.
20233 *
20234 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20235 */
20236 g_signal_new ("handle-is-on",
20237 G_TYPE_FROM_INTERFACE (iface),
20238 G_SIGNAL_RUN_LAST,
20239 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
20240 g_signal_accumulator_true_handled,
20241 NULL,
20242 g_cclosure_marshal_generic,
20243 G_TYPE_BOOLEAN,
20244 1,
20245 G_TYPE_DBUS_METHOD_INVOCATION);
20246
20247 /**
20248 * Button::handle-sim-button-press:
20249 * @object: A #Button.
20250 * @invocation: A #GDBusMethodInvocation.
20251 *
20252 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
20253 *
20254 * 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.
20255 *
20256 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20257 */
20258 g_signal_new ("handle-sim-button-press",
20259 G_TYPE_FROM_INTERFACE (iface),
20260 G_SIGNAL_RUN_LAST,
20261 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
20262 g_signal_accumulator_true_handled,
20263 NULL,
20264 g_cclosure_marshal_generic,
20265 G_TYPE_BOOLEAN,
20266 1,
20267 G_TYPE_DBUS_METHOD_INVOCATION);
20268
20269 /**
20270 * Button::handle-sim-button-long-press:
20271 * @object: A #Button.
20272 * @invocation: A #GDBusMethodInvocation.
20273 *
20274 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
20275 *
20276 * 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.
20277 *
20278 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20279 */
20280 g_signal_new ("handle-sim-button-long-press",
20281 G_TYPE_FROM_INTERFACE (iface),
20282 G_SIGNAL_RUN_LAST,
20283 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
20284 g_signal_accumulator_true_handled,
20285 NULL,
20286 g_cclosure_marshal_generic,
20287 G_TYPE_BOOLEAN,
20288 1,
20289 G_TYPE_DBUS_METHOD_INVOCATION);
20290
20291 /* GObject signals for received D-Bus signals: */
20292 /**
20293 * Button::button-release:
20294 * @object: A #Button.
20295 *
20296 * 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.
20297 *
20298 * 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.
20299 */
20300 g_signal_new ("button-release",
20301 G_TYPE_FROM_INTERFACE (iface),
20302 G_SIGNAL_RUN_LAST,
20303 G_STRUCT_OFFSET (ButtonIface, button_release),
20304 NULL,
20305 NULL,
20306 g_cclosure_marshal_generic,
20307 G_TYPE_NONE,
20308 0);
20309
20310 /**
20311 * Button::button-pressed:
20312 * @object: A #Button.
20313 *
20314 * 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.
20315 *
20316 * 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.
20317 */
20318 g_signal_new ("button-pressed",
20319 G_TYPE_FROM_INTERFACE (iface),
20320 G_SIGNAL_RUN_LAST,
20321 G_STRUCT_OFFSET (ButtonIface, button_pressed),
20322 NULL,
20323 NULL,
20324 g_cclosure_marshal_generic,
20325 G_TYPE_NONE,
20326 0);
20327
20328 /**
20329 * Button::button-pressed-long:
20330 * @object: A #Button.
20331 *
20332 * 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.
20333 *
20334 * 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.
20335 */
20336 g_signal_new ("button-pressed-long",
20337 G_TYPE_FROM_INTERFACE (iface),
20338 G_SIGNAL_RUN_LAST,
20339 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
20340 NULL,
20341 NULL,
20342 g_cclosure_marshal_generic,
20343 G_TYPE_NONE,
20344 0);
20345
20346 /* GObject properties for D-Bus properties: */
20347 /**
20348 * Button:state:
20349 *
20350 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
20351 *
20352 * 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.
20353 */
20354 g_object_interface_install_property (iface,
20355 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20356}
20357
20358/**
20359 * button_get_state: (skip)
20360 * @object: A #Button.
20361 *
20362 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
20363 *
20364 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20365 *
20366 * Returns: The property value.
20367 */
20368gboolean
20369button_get_state (Button *object)
20370{
20371 return BUTTON_GET_IFACE (object)->get_state (object);
20372}
20373
20374/**
20375 * button_set_state: (skip)
20376 * @object: A #Button.
20377 * @value: The value to set.
20378 *
20379 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
20380 *
20381 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20382 */
20383void
20384button_set_state (Button *object, gboolean value)
20385{
20386 g_object_set (G_OBJECT (object), "state", value, NULL);
20387}
20388
20389/**
20390 * button_emit_button_release:
20391 * @object: A #Button.
20392 *
20393 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
20394 */
20395void
20396button_emit_button_release (
20397 Button *object)
20398{
20399 g_signal_emit_by_name (object, "button-release");
20400}
20401
20402/**
20403 * button_emit_button_pressed:
20404 * @object: A #Button.
20405 *
20406 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
20407 */
20408void
20409button_emit_button_pressed (
20410 Button *object)
20411{
20412 g_signal_emit_by_name (object, "button-pressed");
20413}
20414
20415/**
20416 * button_emit_button_pressed_long:
20417 * @object: A #Button.
20418 *
20419 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
20420 */
20421void
20422button_emit_button_pressed_long (
20423 Button *object)
20424{
20425 g_signal_emit_by_name (object, "button-pressed-long");
20426}
20427
20428/**
20429 * button_call_is_on:
20430 * @proxy: A #ButtonProxy.
20431 * @cancellable: (allow-none): A #GCancellable or %NULL.
20432 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20433 * @user_data: User data to pass to @callback.
20434 *
20435 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
20436 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20437 * You can then call button_call_is_on_finish() to get the result of the operation.
20438 *
20439 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
20440 */
20441void
20442button_call_is_on (
20443 Button *proxy,
20444 GCancellable *cancellable,
20445 GAsyncReadyCallback callback,
20446 gpointer user_data)
20447{
20448 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20449 "isOn",
20450 g_variant_new ("()"),
20451 G_DBUS_CALL_FLAGS_NONE,
20452 -1,
20453 cancellable,
20454 callback,
20455 user_data);
20456}
20457
20458/**
20459 * button_call_is_on_finish:
20460 * @proxy: A #ButtonProxy.
20461 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20462 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
20463 * @error: Return location for error or %NULL.
20464 *
20465 * Finishes an operation started with button_call_is_on().
20466 *
20467 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20468 */
20469gboolean
20470button_call_is_on_finish (
20471 Button *proxy,
20472 gboolean *out_state,
20473 GAsyncResult *res,
20474 GError **error)
20475{
20476 GVariant *_ret;
20477 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20478 if (_ret == NULL)
20479 goto _out;
20480 g_variant_get (_ret,
20481 "(b)",
20482 out_state);
20483 g_variant_unref (_ret);
20484_out:
20485 return _ret != NULL;
20486}
20487
20488/**
20489 * button_call_is_on_sync:
20490 * @proxy: A #ButtonProxy.
20491 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20492 * @cancellable: (allow-none): A #GCancellable or %NULL.
20493 * @error: Return location for error or %NULL.
20494 *
20495 * 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.
20496 *
20497 * See button_call_is_on() for the asynchronous version of this method.
20498 *
20499 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20500 */
20501gboolean
20502button_call_is_on_sync (
20503 Button *proxy,
20504 gboolean *out_state,
20505 GCancellable *cancellable,
20506 GError **error)
20507{
20508 GVariant *_ret;
20509 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20510 "isOn",
20511 g_variant_new ("()"),
20512 G_DBUS_CALL_FLAGS_NONE,
20513 -1,
20514 cancellable,
20515 error);
20516 if (_ret == NULL)
20517 goto _out;
20518 g_variant_get (_ret,
20519 "(b)",
20520 out_state);
20521 g_variant_unref (_ret);
20522_out:
20523 return _ret != NULL;
20524}
20525
20526/**
20527 * button_call_sim_button_press:
20528 * @proxy: A #ButtonProxy.
20529 * @cancellable: (allow-none): A #GCancellable or %NULL.
20530 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20531 * @user_data: User data to pass to @callback.
20532 *
20533 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
20534 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20535 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
20536 *
20537 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
20538 */
20539void
20540button_call_sim_button_press (
20541 Button *proxy,
20542 GCancellable *cancellable,
20543 GAsyncReadyCallback callback,
20544 gpointer user_data)
20545{
20546 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20547 "simButtonPress",
20548 g_variant_new ("()"),
20549 G_DBUS_CALL_FLAGS_NONE,
20550 -1,
20551 cancellable,
20552 callback,
20553 user_data);
20554}
20555
20556/**
20557 * button_call_sim_button_press_finish:
20558 * @proxy: A #ButtonProxy.
20559 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
20560 * @error: Return location for error or %NULL.
20561 *
20562 * Finishes an operation started with button_call_sim_button_press().
20563 *
20564 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20565 */
20566gboolean
20567button_call_sim_button_press_finish (
20568 Button *proxy,
20569 GAsyncResult *res,
20570 GError **error)
20571{
20572 GVariant *_ret;
20573 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20574 if (_ret == NULL)
20575 goto _out;
20576 g_variant_get (_ret,
20577 "()");
20578 g_variant_unref (_ret);
20579_out:
20580 return _ret != NULL;
20581}
20582
20583/**
20584 * button_call_sim_button_press_sync:
20585 * @proxy: A #ButtonProxy.
20586 * @cancellable: (allow-none): A #GCancellable or %NULL.
20587 * @error: Return location for error or %NULL.
20588 *
20589 * 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.
20590 *
20591 * See button_call_sim_button_press() for the asynchronous version of this method.
20592 *
20593 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20594 */
20595gboolean
20596button_call_sim_button_press_sync (
20597 Button *proxy,
20598 GCancellable *cancellable,
20599 GError **error)
20600{
20601 GVariant *_ret;
20602 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20603 "simButtonPress",
20604 g_variant_new ("()"),
20605 G_DBUS_CALL_FLAGS_NONE,
20606 -1,
20607 cancellable,
20608 error);
20609 if (_ret == NULL)
20610 goto _out;
20611 g_variant_get (_ret,
20612 "()");
20613 g_variant_unref (_ret);
20614_out:
20615 return _ret != NULL;
20616}
20617
20618/**
20619 * button_call_sim_button_long_press:
20620 * @proxy: A #ButtonProxy.
20621 * @cancellable: (allow-none): A #GCancellable or %NULL.
20622 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20623 * @user_data: User data to pass to @callback.
20624 *
20625 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
20626 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20627 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
20628 *
20629 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
20630 */
20631void
20632button_call_sim_button_long_press (
20633 Button *proxy,
20634 GCancellable *cancellable,
20635 GAsyncReadyCallback callback,
20636 gpointer user_data)
20637{
20638 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20639 "simButtonLongPress",
20640 g_variant_new ("()"),
20641 G_DBUS_CALL_FLAGS_NONE,
20642 -1,
20643 cancellable,
20644 callback,
20645 user_data);
20646}
20647
20648/**
20649 * button_call_sim_button_long_press_finish:
20650 * @proxy: A #ButtonProxy.
20651 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
20652 * @error: Return location for error or %NULL.
20653 *
20654 * Finishes an operation started with button_call_sim_button_long_press().
20655 *
20656 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20657 */
20658gboolean
20659button_call_sim_button_long_press_finish (
20660 Button *proxy,
20661 GAsyncResult *res,
20662 GError **error)
20663{
20664 GVariant *_ret;
20665 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20666 if (_ret == NULL)
20667 goto _out;
20668 g_variant_get (_ret,
20669 "()");
20670 g_variant_unref (_ret);
20671_out:
20672 return _ret != NULL;
20673}
20674
20675/**
20676 * button_call_sim_button_long_press_sync:
20677 * @proxy: A #ButtonProxy.
20678 * @cancellable: (allow-none): A #GCancellable or %NULL.
20679 * @error: Return location for error or %NULL.
20680 *
20681 * 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.
20682 *
20683 * See button_call_sim_button_long_press() for the asynchronous version of this method.
20684 *
20685 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20686 */
20687gboolean
20688button_call_sim_button_long_press_sync (
20689 Button *proxy,
20690 GCancellable *cancellable,
20691 GError **error)
20692{
20693 GVariant *_ret;
20694 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20695 "simButtonLongPress",
20696 g_variant_new ("()"),
20697 G_DBUS_CALL_FLAGS_NONE,
20698 -1,
20699 cancellable,
20700 error);
20701 if (_ret == NULL)
20702 goto _out;
20703 g_variant_get (_ret,
20704 "()");
20705 g_variant_unref (_ret);
20706_out:
20707 return _ret != NULL;
20708}
20709
20710/**
20711 * button_complete_is_on:
20712 * @object: A #Button.
20713 * @invocation: (transfer full): A #GDBusMethodInvocation.
20714 * @state: Parameter to return.
20715 *
20716 * 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.
20717 *
20718 * This method will free @invocation, you cannot use it afterwards.
20719 */
20720void
20721button_complete_is_on (
20722 Button *object,
20723 GDBusMethodInvocation *invocation,
20724 gboolean state)
20725{
20726 g_dbus_method_invocation_return_value (invocation,
20727 g_variant_new ("(b)",
20728 state));
20729}
20730
20731/**
20732 * button_complete_sim_button_press:
20733 * @object: A #Button.
20734 * @invocation: (transfer full): A #GDBusMethodInvocation.
20735 *
20736 * 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.
20737 *
20738 * This method will free @invocation, you cannot use it afterwards.
20739 */
20740void
20741button_complete_sim_button_press (
20742 Button *object,
20743 GDBusMethodInvocation *invocation)
20744{
20745 g_dbus_method_invocation_return_value (invocation,
20746 g_variant_new ("()"));
20747}
20748
20749/**
20750 * button_complete_sim_button_long_press:
20751 * @object: A #Button.
20752 * @invocation: (transfer full): A #GDBusMethodInvocation.
20753 *
20754 * 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.
20755 *
20756 * This method will free @invocation, you cannot use it afterwards.
20757 */
20758void
20759button_complete_sim_button_long_press (
20760 Button *object,
20761 GDBusMethodInvocation *invocation)
20762{
20763 g_dbus_method_invocation_return_value (invocation,
20764 g_variant_new ("()"));
20765}
20766
20767/* ------------------------------------------------------------------------ */
20768
20769/**
20770 * ButtonProxy:
20771 *
20772 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
20773 */
20774
20775/**
20776 * ButtonProxyClass:
20777 * @parent_class: The parent class.
20778 *
20779 * Class structure for #ButtonProxy.
20780 */
20781
20782struct _ButtonProxyPrivate
20783{
20784 GData *qdata;
20785};
20786
20787static void button_proxy_iface_init (ButtonIface *iface);
20788
20789#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20790G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
20791 G_ADD_PRIVATE (ButtonProxy)
20792 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
20793
20794#else
20795G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
20796 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
20797
20798#endif
20799static void
20800button_proxy_finalize (GObject *object)
20801{
20802 ButtonProxy *proxy = BUTTON_PROXY (object);
20803 g_datalist_clear (&proxy->priv->qdata);
20804 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
20805}
20806
20807static void
20808button_proxy_get_property (GObject *object,
20809 guint prop_id,
20810 GValue *value,
20811 GParamSpec *pspec G_GNUC_UNUSED)
20812{
20813 const _ExtendedGDBusPropertyInfo *info;
20814 GVariant *variant;
20815 g_assert (prop_id != 0 && prop_id - 1 < 1);
20816 info = _button_property_info_pointers[prop_id - 1];
20817 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
20818 if (info->use_gvariant)
20819 {
20820 g_value_set_variant (value, variant);
20821 }
20822 else
20823 {
20824 if (variant != NULL)
20825 g_dbus_gvariant_to_gvalue (variant, value);
20826 }
20827 if (variant != NULL)
20828 g_variant_unref (variant);
20829}
20830
20831static void
20832button_proxy_set_property_cb (GDBusProxy *proxy,
20833 GAsyncResult *res,
20834 gpointer user_data)
20835{
20836 const _ExtendedGDBusPropertyInfo *info = user_data;
20837 GError *error;
20838 GVariant *_ret;
20839 error = NULL;
20840 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
20841 if (!_ret)
20842 {
20843 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
20844 info->parent_struct.name,
20845 error->message, g_quark_to_string (error->domain), error->code);
20846 g_error_free (error);
20847 }
20848 else
20849 {
20850 g_variant_unref (_ret);
20851 }
20852}
20853
20854static void
20855button_proxy_set_property (GObject *object,
20856 guint prop_id,
20857 const GValue *value,
20858 GParamSpec *pspec G_GNUC_UNUSED)
20859{
20860 const _ExtendedGDBusPropertyInfo *info;
20861 GVariant *variant;
20862 g_assert (prop_id != 0 && prop_id - 1 < 1);
20863 info = _button_property_info_pointers[prop_id - 1];
20864 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
20865 g_dbus_proxy_call (G_DBUS_PROXY (object),
20866 "org.freedesktop.DBus.Properties.Set",
20867 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
20868 G_DBUS_CALL_FLAGS_NONE,
20869 -1,
20870 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
20871 g_variant_unref (variant);
20872}
20873
20874static void
20875button_proxy_g_signal (GDBusProxy *proxy,
20876 const gchar *sender_name G_GNUC_UNUSED,
20877 const gchar *signal_name,
20878 GVariant *parameters)
20879{
20880 _ExtendedGDBusSignalInfo *info;
20881 GVariantIter iter;
20882 GVariant *child;
20883 GValue *paramv;
20884 guint num_params;
20885 guint n;
20886 guint signal_id;
20887 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
20888 if (info == NULL)
20889 return;
20890 num_params = g_variant_n_children (parameters);
20891 paramv = g_new0 (GValue, num_params + 1);
20892 g_value_init (&paramv[0], TYPE_BUTTON);
20893 g_value_set_object (&paramv[0], proxy);
20894 g_variant_iter_init (&iter, parameters);
20895 n = 1;
20896 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20897 {
20898 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20899 if (arg_info->use_gvariant)
20900 {
20901 g_value_init (&paramv[n], G_TYPE_VARIANT);
20902 g_value_set_variant (&paramv[n], child);
20903 n++;
20904 }
20905 else
20906 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20907 g_variant_unref (child);
20908 }
20909 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
20910 g_signal_emitv (paramv, signal_id, 0, NULL);
20911 for (n = 0; n < num_params + 1; n++)
20912 g_value_unset (&paramv[n]);
20913 g_free (paramv);
20914}
20915
20916static void
20917button_proxy_g_properties_changed (GDBusProxy *_proxy,
20918 GVariant *changed_properties,
20919 const gchar *const *invalidated_properties)
20920{
20921 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
20922 guint n;
20923 const gchar *key;
20924 GVariantIter *iter;
20925 _ExtendedGDBusPropertyInfo *info;
20926 g_variant_get (changed_properties, "a{sv}", &iter);
20927 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20928 {
20929 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
20930 g_datalist_remove_data (&proxy->priv->qdata, key);
20931 if (info != NULL)
20932 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20933 }
20934 g_variant_iter_free (iter);
20935 for (n = 0; invalidated_properties[n] != NULL; n++)
20936 {
20937 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
20938 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20939 if (info != NULL)
20940 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20941 }
20942}
20943
20944static gboolean
20945button_proxy_get_state (Button *object)
20946{
20947 ButtonProxy *proxy = BUTTON_PROXY (object);
20948 GVariant *variant;
20949 gboolean value = 0;
20950 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
20951 if (variant != NULL)
20952 {
20953 value = g_variant_get_boolean (variant);
20954 g_variant_unref (variant);
20955 }
20956 return value;
20957}
20958
20959static void
20960button_proxy_init (ButtonProxy *proxy)
20961{
20962#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20963 proxy->priv = button_proxy_get_instance_private (proxy);
20964#else
20965 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
20966#endif
20967
20968 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
20969}
20970
20971static void
20972button_proxy_class_init (ButtonProxyClass *klass)
20973{
20974 GObjectClass *gobject_class;
20975 GDBusProxyClass *proxy_class;
20976
20977 gobject_class = G_OBJECT_CLASS (klass);
20978 gobject_class->finalize = button_proxy_finalize;
20979 gobject_class->get_property = button_proxy_get_property;
20980 gobject_class->set_property = button_proxy_set_property;
20981
20982 proxy_class = G_DBUS_PROXY_CLASS (klass);
20983 proxy_class->g_signal = button_proxy_g_signal;
20984 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
20985
20986 button_override_properties (gobject_class, 1);
20987
20988#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20989 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
20990#endif
20991}
20992
20993static void
20994button_proxy_iface_init (ButtonIface *iface)
20995{
20996 iface->get_state = button_proxy_get_state;
20997}
20998
20999/**
21000 * button_proxy_new:
21001 * @connection: A #GDBusConnection.
21002 * @flags: Flags from the #GDBusProxyFlags enumeration.
21003 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21004 * @object_path: An object path.
21005 * @cancellable: (allow-none): A #GCancellable or %NULL.
21006 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21007 * @user_data: User data to pass to @callback.
21008 *
21009 * 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.
21010 *
21011 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21012 * You can then call button_proxy_new_finish() to get the result of the operation.
21013 *
21014 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
21015 */
21016void
21017button_proxy_new (
21018 GDBusConnection *connection,
21019 GDBusProxyFlags flags,
21020 const gchar *name,
21021 const gchar *object_path,
21022 GCancellable *cancellable,
21023 GAsyncReadyCallback callback,
21024 gpointer user_data)
21025{
21026 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);
21027}
21028
21029/**
21030 * button_proxy_new_finish:
21031 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
21032 * @error: Return location for error or %NULL
21033 *
21034 * Finishes an operation started with button_proxy_new().
21035 *
21036 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21037 */
21038Button *
21039button_proxy_new_finish (
21040 GAsyncResult *res,
21041 GError **error)
21042{
21043 GObject *ret;
21044 GObject *source_object;
21045 source_object = g_async_result_get_source_object (res);
21046 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21047 g_object_unref (source_object);
21048 if (ret != NULL)
21049 return BUTTON (ret);
21050 else
21051 return NULL;
21052}
21053
21054/**
21055 * button_proxy_new_sync:
21056 * @connection: A #GDBusConnection.
21057 * @flags: Flags from the #GDBusProxyFlags enumeration.
21058 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21059 * @object_path: An object path.
21060 * @cancellable: (allow-none): A #GCancellable or %NULL.
21061 * @error: Return location for error or %NULL
21062 *
21063 * 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.
21064 *
21065 * The calling thread is blocked until a reply is received.
21066 *
21067 * See button_proxy_new() for the asynchronous version of this constructor.
21068 *
21069 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21070 */
21071Button *
21072button_proxy_new_sync (
21073 GDBusConnection *connection,
21074 GDBusProxyFlags flags,
21075 const gchar *name,
21076 const gchar *object_path,
21077 GCancellable *cancellable,
21078 GError **error)
21079{
21080 GInitable *ret;
21081 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);
21082 if (ret != NULL)
21083 return BUTTON (ret);
21084 else
21085 return NULL;
21086}
21087
21088
21089/**
21090 * button_proxy_new_for_bus:
21091 * @bus_type: A #GBusType.
21092 * @flags: Flags from the #GDBusProxyFlags enumeration.
21093 * @name: A bus name (well-known or unique).
21094 * @object_path: An object path.
21095 * @cancellable: (allow-none): A #GCancellable or %NULL.
21096 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21097 * @user_data: User data to pass to @callback.
21098 *
21099 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21100 *
21101 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21102 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
21103 *
21104 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21105 */
21106void
21107button_proxy_new_for_bus (
21108 GBusType bus_type,
21109 GDBusProxyFlags flags,
21110 const gchar *name,
21111 const gchar *object_path,
21112 GCancellable *cancellable,
21113 GAsyncReadyCallback callback,
21114 gpointer user_data)
21115{
21116 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);
21117}
21118
21119/**
21120 * button_proxy_new_for_bus_finish:
21121 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
21122 * @error: Return location for error or %NULL
21123 *
21124 * Finishes an operation started with button_proxy_new_for_bus().
21125 *
21126 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21127 */
21128Button *
21129button_proxy_new_for_bus_finish (
21130 GAsyncResult *res,
21131 GError **error)
21132{
21133 GObject *ret;
21134 GObject *source_object;
21135 source_object = g_async_result_get_source_object (res);
21136 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21137 g_object_unref (source_object);
21138 if (ret != NULL)
21139 return BUTTON (ret);
21140 else
21141 return NULL;
21142}
21143
21144/**
21145 * button_proxy_new_for_bus_sync:
21146 * @bus_type: A #GBusType.
21147 * @flags: Flags from the #GDBusProxyFlags enumeration.
21148 * @name: A bus name (well-known or unique).
21149 * @object_path: An object path.
21150 * @cancellable: (allow-none): A #GCancellable or %NULL.
21151 * @error: Return location for error or %NULL
21152 *
21153 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21154 *
21155 * The calling thread is blocked until a reply is received.
21156 *
21157 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
21158 *
21159 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21160 */
21161Button *
21162button_proxy_new_for_bus_sync (
21163 GBusType bus_type,
21164 GDBusProxyFlags flags,
21165 const gchar *name,
21166 const gchar *object_path,
21167 GCancellable *cancellable,
21168 GError **error)
21169{
21170 GInitable *ret;
21171 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);
21172 if (ret != NULL)
21173 return BUTTON (ret);
21174 else
21175 return NULL;
21176}
21177
21178
21179/* ------------------------------------------------------------------------ */
21180
21181/**
21182 * ButtonSkeleton:
21183 *
21184 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
21185 */
21186
21187/**
21188 * ButtonSkeletonClass:
21189 * @parent_class: The parent class.
21190 *
21191 * Class structure for #ButtonSkeleton.
21192 */
21193
21194struct _ButtonSkeletonPrivate
21195{
21196 GValue *properties;
21197 GList *changed_properties;
21198 GSource *changed_properties_idle_source;
21199 GMainContext *context;
21200 GMutex lock;
21201};
21202
21203static void
21204_button_skeleton_handle_method_call (
21205 GDBusConnection *connection G_GNUC_UNUSED,
21206 const gchar *sender G_GNUC_UNUSED,
21207 const gchar *object_path G_GNUC_UNUSED,
21208 const gchar *interface_name,
21209 const gchar *method_name,
21210 GVariant *parameters,
21211 GDBusMethodInvocation *invocation,
21212 gpointer user_data)
21213{
21214 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21215 _ExtendedGDBusMethodInfo *info;
21216 GVariantIter iter;
21217 GVariant *child;
21218 GValue *paramv;
21219 guint num_params;
21220 guint num_extra;
21221 guint n;
21222 guint signal_id;
21223 GValue return_value = G_VALUE_INIT;
21224 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21225 g_assert (info != NULL);
21226 num_params = g_variant_n_children (parameters);
21227 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21228 n = 0;
21229 g_value_init (&paramv[n], TYPE_BUTTON);
21230 g_value_set_object (&paramv[n++], skeleton);
21231 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21232 g_value_set_object (&paramv[n++], invocation);
21233 if (info->pass_fdlist)
21234 {
21235#ifdef G_OS_UNIX
21236 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21237 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21238#else
21239 g_assert_not_reached ();
21240#endif
21241 }
21242 g_variant_iter_init (&iter, parameters);
21243 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21244 {
21245 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21246 if (arg_info->use_gvariant)
21247 {
21248 g_value_init (&paramv[n], G_TYPE_VARIANT);
21249 g_value_set_variant (&paramv[n], child);
21250 n++;
21251 }
21252 else
21253 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21254 g_variant_unref (child);
21255 }
21256 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
21257 g_value_init (&return_value, G_TYPE_BOOLEAN);
21258 g_signal_emitv (paramv, signal_id, 0, &return_value);
21259 if (!g_value_get_boolean (&return_value))
21260 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);
21261 g_value_unset (&return_value);
21262 for (n = 0; n < num_params + num_extra; n++)
21263 g_value_unset (&paramv[n]);
21264 g_free (paramv);
21265}
21266
21267static GVariant *
21268_button_skeleton_handle_get_property (
21269 GDBusConnection *connection G_GNUC_UNUSED,
21270 const gchar *sender G_GNUC_UNUSED,
21271 const gchar *object_path G_GNUC_UNUSED,
21272 const gchar *interface_name G_GNUC_UNUSED,
21273 const gchar *property_name,
21274 GError **error,
21275 gpointer user_data)
21276{
21277 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21278 GValue value = G_VALUE_INIT;
21279 GParamSpec *pspec;
21280 _ExtendedGDBusPropertyInfo *info;
21281 GVariant *ret;
21282 ret = NULL;
21283 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21284 g_assert (info != NULL);
21285 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21286 if (pspec == NULL)
21287 {
21288 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21289 }
21290 else
21291 {
21292 g_value_init (&value, pspec->value_type);
21293 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21294 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21295 g_value_unset (&value);
21296 }
21297 return ret;
21298}
21299
21300static gboolean
21301_button_skeleton_handle_set_property (
21302 GDBusConnection *connection G_GNUC_UNUSED,
21303 const gchar *sender G_GNUC_UNUSED,
21304 const gchar *object_path G_GNUC_UNUSED,
21305 const gchar *interface_name G_GNUC_UNUSED,
21306 const gchar *property_name,
21307 GVariant *variant,
21308 GError **error,
21309 gpointer user_data)
21310{
21311 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21312 GValue value = G_VALUE_INIT;
21313 GParamSpec *pspec;
21314 _ExtendedGDBusPropertyInfo *info;
21315 gboolean ret;
21316 ret = FALSE;
21317 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21318 g_assert (info != NULL);
21319 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21320 if (pspec == NULL)
21321 {
21322 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21323 }
21324 else
21325 {
21326 if (info->use_gvariant)
21327 g_value_set_variant (&value, variant);
21328 else
21329 g_dbus_gvariant_to_gvalue (variant, &value);
21330 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21331 g_value_unset (&value);
21332 ret = TRUE;
21333 }
21334 return ret;
21335}
21336
21337static const GDBusInterfaceVTable _button_skeleton_vtable =
21338{
21339 _button_skeleton_handle_method_call,
21340 _button_skeleton_handle_get_property,
21341 _button_skeleton_handle_set_property,
21342 {NULL}
21343};
21344
21345static GDBusInterfaceInfo *
21346button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21347{
21348 return button_interface_info ();
21349}
21350
21351static GDBusInterfaceVTable *
21352button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21353{
21354 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
21355}
21356
21357static GVariant *
21358button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21359{
21360 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21361
21362 GVariantBuilder builder;
21363 guint n;
21364 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21365 if (_button_interface_info.parent_struct.properties == NULL)
21366 goto out;
21367 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
21368 {
21369 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
21370 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21371 {
21372 GVariant *value;
21373 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);
21374 if (value != NULL)
21375 {
21376 g_variant_take_ref (value);
21377 g_variant_builder_add (&builder, "{sv}", info->name, value);
21378 g_variant_unref (value);
21379 }
21380 }
21381 }
21382out:
21383 return g_variant_builder_end (&builder);
21384}
21385
21386static gboolean _button_emit_changed (gpointer user_data);
21387
21388static void
21389button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21390{
21391 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21392 gboolean emit_changed = FALSE;
21393
21394 g_mutex_lock (&skeleton->priv->lock);
21395 if (skeleton->priv->changed_properties_idle_source != NULL)
21396 {
21397 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21398 skeleton->priv->changed_properties_idle_source = NULL;
21399 emit_changed = TRUE;
21400 }
21401 g_mutex_unlock (&skeleton->priv->lock);
21402
21403 if (emit_changed)
21404 _button_emit_changed (skeleton);
21405}
21406
21407static void
21408_button_on_signal_button_release (
21409 Button *object)
21410{
21411 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21412
21413 GList *connections, *l;
21414 GVariant *signal_variant;
21415 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21416
21417 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21418 for (l = connections; l != NULL; l = l->next)
21419 {
21420 GDBusConnection *connection = l->data;
21421 g_dbus_connection_emit_signal (connection,
21422 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
21423 signal_variant, NULL);
21424 }
21425 g_variant_unref (signal_variant);
21426 g_list_free_full (connections, g_object_unref);
21427}
21428
21429static void
21430_button_on_signal_button_pressed (
21431 Button *object)
21432{
21433 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21434
21435 GList *connections, *l;
21436 GVariant *signal_variant;
21437 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21438
21439 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21440 for (l = connections; l != NULL; l = l->next)
21441 {
21442 GDBusConnection *connection = l->data;
21443 g_dbus_connection_emit_signal (connection,
21444 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
21445 signal_variant, NULL);
21446 }
21447 g_variant_unref (signal_variant);
21448 g_list_free_full (connections, g_object_unref);
21449}
21450
21451static void
21452_button_on_signal_button_pressed_long (
21453 Button *object)
21454{
21455 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21456
21457 GList *connections, *l;
21458 GVariant *signal_variant;
21459 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21460
21461 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21462 for (l = connections; l != NULL; l = l->next)
21463 {
21464 GDBusConnection *connection = l->data;
21465 g_dbus_connection_emit_signal (connection,
21466 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
21467 signal_variant, NULL);
21468 }
21469 g_variant_unref (signal_variant);
21470 g_list_free_full (connections, g_object_unref);
21471}
21472
21473static void button_skeleton_iface_init (ButtonIface *iface);
21474#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21475G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21476 G_ADD_PRIVATE (ButtonSkeleton)
21477 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21478
21479#else
21480G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21481 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21482
21483#endif
21484static void
21485button_skeleton_finalize (GObject *object)
21486{
21487 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21488 guint n;
21489 for (n = 0; n < 1; n++)
21490 g_value_unset (&skeleton->priv->properties[n]);
21491 g_free (skeleton->priv->properties);
21492 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21493 if (skeleton->priv->changed_properties_idle_source != NULL)
21494 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21495 g_main_context_unref (skeleton->priv->context);
21496 g_mutex_clear (&skeleton->priv->lock);
21497 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
21498}
21499
21500static void
21501button_skeleton_get_property (GObject *object,
21502 guint prop_id,
21503 GValue *value,
21504 GParamSpec *pspec G_GNUC_UNUSED)
21505{
21506 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21507 g_assert (prop_id != 0 && prop_id - 1 < 1);
21508 g_mutex_lock (&skeleton->priv->lock);
21509 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
21510 g_mutex_unlock (&skeleton->priv->lock);
21511}
21512
21513static gboolean
21514_button_emit_changed (gpointer user_data)
21515{
21516 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21517 GList *l;
21518 GVariantBuilder builder;
21519 GVariantBuilder invalidated_builder;
21520 guint num_changes;
21521
21522 g_mutex_lock (&skeleton->priv->lock);
21523 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21524 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
21525 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
21526 {
21527 ChangedProperty *cp = l->data;
21528 GVariant *variant;
21529 const GValue *cur_value;
21530
21531 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
21532 if (!_g_value_equal (cur_value, &cp->orig_value))
21533 {
21534 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
21535 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
21536 g_variant_unref (variant);
21537 num_changes++;
21538 }
21539 }
21540 if (num_changes > 0)
21541 {
21542 GList *connections, *ll;
21543 GVariant *signal_variant;
21544 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
21545 &builder, &invalidated_builder));
21546 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21547 for (ll = connections; ll != NULL; ll = ll->next)
21548 {
21549 GDBusConnection *connection = ll->data;
21550
21551 g_dbus_connection_emit_signal (connection,
21552 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
21553 "org.freedesktop.DBus.Properties",
21554 "PropertiesChanged",
21555 signal_variant,
21556 NULL);
21557 }
21558 g_variant_unref (signal_variant);
21559 g_list_free_full (connections, g_object_unref);
21560 }
21561 else
21562 {
21563 g_variant_builder_clear (&builder);
21564 g_variant_builder_clear (&invalidated_builder);
21565 }
21566 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21567 skeleton->priv->changed_properties = NULL;
21568 skeleton->priv->changed_properties_idle_source = NULL;
21569 g_mutex_unlock (&skeleton->priv->lock);
21570 return FALSE;
21571}
21572
21573static void
21574_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
21575{
21576 ChangedProperty *cp;
21577 GList *l;
21578 cp = NULL;
21579 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
21580 {
21581 ChangedProperty *i_cp = l->data;
21582 if (i_cp->info == info)
21583 {
21584 cp = i_cp;
21585 break;
21586 }
21587 }
21588 if (cp == NULL)
21589 {
21590 cp = g_new0 (ChangedProperty, 1);
21591 cp->prop_id = prop_id;
21592 cp->info = info;
21593 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
21594 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
21595 g_value_copy (orig_value, &cp->orig_value);
21596 }
21597}
21598
21599static void
21600button_skeleton_notify (GObject *object,
21601 GParamSpec *pspec G_GNUC_UNUSED)
21602{
21603 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21604 g_mutex_lock (&skeleton->priv->lock);
21605 if (skeleton->priv->changed_properties != NULL &&
21606 skeleton->priv->changed_properties_idle_source == NULL)
21607 {
21608 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
21609 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
21610 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
21611 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
21612 g_source_unref (skeleton->priv->changed_properties_idle_source);
21613 }
21614 g_mutex_unlock (&skeleton->priv->lock);
21615}
21616
21617static void
21618button_skeleton_set_property (GObject *object,
21619 guint prop_id,
21620 const GValue *value,
21621 GParamSpec *pspec)
21622{
21623 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21624 g_assert (prop_id != 0 && prop_id - 1 < 1);
21625 g_mutex_lock (&skeleton->priv->lock);
21626 g_object_freeze_notify (object);
21627 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
21628 {
21629 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
21630 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
21631 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
21632 g_object_notify_by_pspec (object, pspec);
21633 }
21634 g_mutex_unlock (&skeleton->priv->lock);
21635 g_object_thaw_notify (object);
21636}
21637
21638static void
21639button_skeleton_init (ButtonSkeleton *skeleton)
21640{
21641#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21642 skeleton->priv = button_skeleton_get_instance_private (skeleton);
21643#else
21644 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
21645#endif
21646
21647 g_mutex_init (&skeleton->priv->lock);
21648 skeleton->priv->context = g_main_context_ref_thread_default ();
21649 skeleton->priv->properties = g_new0 (GValue, 1);
21650 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
21651}
21652
21653static gboolean
21654button_skeleton_get_state (Button *object)
21655{
21656 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21657 gboolean value;
21658 g_mutex_lock (&skeleton->priv->lock);
21659 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
21660 g_mutex_unlock (&skeleton->priv->lock);
21661 return value;
21662}
21663
21664static void
21665button_skeleton_class_init (ButtonSkeletonClass *klass)
21666{
21667 GObjectClass *gobject_class;
21668 GDBusInterfaceSkeletonClass *skeleton_class;
21669
21670 gobject_class = G_OBJECT_CLASS (klass);
21671 gobject_class->finalize = button_skeleton_finalize;
21672 gobject_class->get_property = button_skeleton_get_property;
21673 gobject_class->set_property = button_skeleton_set_property;
21674 gobject_class->notify = button_skeleton_notify;
21675
21676
21677 button_override_properties (gobject_class, 1);
21678
21679 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21680 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
21681 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
21682 skeleton_class->flush = button_skeleton_dbus_interface_flush;
21683 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
21684
21685#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21686 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
21687#endif
21688}
21689
21690static void
21691button_skeleton_iface_init (ButtonIface *iface)
21692{
21693 iface->button_release = _button_on_signal_button_release;
21694 iface->button_pressed = _button_on_signal_button_pressed;
21695 iface->button_pressed_long = _button_on_signal_button_pressed_long;
21696 iface->get_state = button_skeleton_get_state;
21697}
21698
21699/**
21700 * button_skeleton_new:
21701 *
21702 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
21703 *
21704 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
21705 */
21706Button *
21707button_skeleton_new (void)
21708{
21709 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
21710}
21711
21712/* ------------------------------------------------------------------------
21713 * Code for interface org.openbmc.Led
21714 * ------------------------------------------------------------------------
21715 */
21716
21717/**
21718 * SECTION:Led
21719 * @title: Led
21720 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
21721 *
21722 * 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.
21723 */
21724
21725/* ---- Introspection data for org.openbmc.Led ---- */
21726
21727static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
21728{
21729 {
21730 -1,
21731 (gchar *) "setOn",
21732 NULL,
21733 NULL,
21734 NULL
21735 },
21736 "handle-set-on",
21737 FALSE
21738};
21739
21740static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
21741{
21742 {
21743 -1,
21744 (gchar *) "setOff",
21745 NULL,
21746 NULL,
21747 NULL
21748 },
21749 "handle-set-off",
21750 FALSE
21751};
21752
21753static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
21754{
21755 {
21756 -1,
21757 (gchar *) "setBlinkSlow",
21758 NULL,
21759 NULL,
21760 NULL
21761 },
21762 "handle-set-blink-slow",
21763 FALSE
21764};
21765
21766static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
21767{
21768 {
21769 -1,
21770 (gchar *) "setBlinkFast",
21771 NULL,
21772 NULL,
21773 NULL
21774 },
21775 "handle-set-blink-fast",
21776 FALSE
21777};
21778
21779static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
21780{
21781 &_led_method_info_set_on,
21782 &_led_method_info_set_off,
21783 &_led_method_info_set_blink_slow,
21784 &_led_method_info_set_blink_fast,
21785 NULL
21786};
21787
21788static const _ExtendedGDBusPropertyInfo _led_property_info_color =
21789{
21790 {
21791 -1,
21792 (gchar *) "color",
21793 (gchar *) "i",
21794 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21795 NULL
21796 },
21797 "color",
21798 FALSE
21799};
21800
21801static const _ExtendedGDBusPropertyInfo _led_property_info_function =
21802{
21803 {
21804 -1,
21805 (gchar *) "function",
21806 (gchar *) "s",
21807 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21808 NULL
21809 },
21810 "function",
21811 FALSE
21812};
21813
21814static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
21815{
21816 &_led_property_info_color,
21817 &_led_property_info_function,
21818 NULL
21819};
21820
21821static const _ExtendedGDBusInterfaceInfo _led_interface_info =
21822{
21823 {
21824 -1,
21825 (gchar *) "org.openbmc.Led",
21826 (GDBusMethodInfo **) &_led_method_info_pointers,
21827 NULL,
21828 (GDBusPropertyInfo **) &_led_property_info_pointers,
21829 NULL
21830 },
21831 "led",
21832};
21833
21834
21835/**
21836 * led_interface_info:
21837 *
21838 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
21839 *
21840 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21841 */
21842GDBusInterfaceInfo *
21843led_interface_info (void)
21844{
21845 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
21846}
21847
21848/**
21849 * led_override_properties:
21850 * @klass: The class structure for a #GObject<!-- -->-derived class.
21851 * @property_id_begin: The property id to assign to the first overridden property.
21852 *
21853 * Overrides all #GObject properties in the #Led interface for a concrete class.
21854 * The properties are overridden in the order they are defined.
21855 *
21856 * Returns: The last property id.
21857 */
21858guint
21859led_override_properties (GObjectClass *klass, guint property_id_begin)
21860{
21861 g_object_class_override_property (klass, property_id_begin++, "color");
21862 g_object_class_override_property (klass, property_id_begin++, "function");
21863 return property_id_begin - 1;
21864}
21865
21866
21867
21868/**
21869 * Led:
21870 *
21871 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
21872 */
21873
21874/**
21875 * LedIface:
21876 * @parent_iface: The parent interface.
21877 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
21878 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
21879 * @handle_set_off: Handler for the #Led::handle-set-off signal.
21880 * @handle_set_on: Handler for the #Led::handle-set-on signal.
21881 * @get_color: Getter for the #Led:color property.
21882 * @get_function: Getter for the #Led:function property.
21883 *
21884 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
21885 */
21886
21887typedef LedIface LedInterface;
21888G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
21889
21890static void
21891led_default_init (LedIface *iface)
21892{
21893 /* GObject signals for incoming D-Bus method calls: */
21894 /**
21895 * Led::handle-set-on:
21896 * @object: A #Led.
21897 * @invocation: A #GDBusMethodInvocation.
21898 *
21899 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
21900 *
21901 * 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.
21902 *
21903 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21904 */
21905 g_signal_new ("handle-set-on",
21906 G_TYPE_FROM_INTERFACE (iface),
21907 G_SIGNAL_RUN_LAST,
21908 G_STRUCT_OFFSET (LedIface, handle_set_on),
21909 g_signal_accumulator_true_handled,
21910 NULL,
21911 g_cclosure_marshal_generic,
21912 G_TYPE_BOOLEAN,
21913 1,
21914 G_TYPE_DBUS_METHOD_INVOCATION);
21915
21916 /**
21917 * Led::handle-set-off:
21918 * @object: A #Led.
21919 * @invocation: A #GDBusMethodInvocation.
21920 *
21921 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
21922 *
21923 * 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.
21924 *
21925 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21926 */
21927 g_signal_new ("handle-set-off",
21928 G_TYPE_FROM_INTERFACE (iface),
21929 G_SIGNAL_RUN_LAST,
21930 G_STRUCT_OFFSET (LedIface, handle_set_off),
21931 g_signal_accumulator_true_handled,
21932 NULL,
21933 g_cclosure_marshal_generic,
21934 G_TYPE_BOOLEAN,
21935 1,
21936 G_TYPE_DBUS_METHOD_INVOCATION);
21937
21938 /**
21939 * Led::handle-set-blink-slow:
21940 * @object: A #Led.
21941 * @invocation: A #GDBusMethodInvocation.
21942 *
21943 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
21944 *
21945 * 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.
21946 *
21947 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21948 */
21949 g_signal_new ("handle-set-blink-slow",
21950 G_TYPE_FROM_INTERFACE (iface),
21951 G_SIGNAL_RUN_LAST,
21952 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
21953 g_signal_accumulator_true_handled,
21954 NULL,
21955 g_cclosure_marshal_generic,
21956 G_TYPE_BOOLEAN,
21957 1,
21958 G_TYPE_DBUS_METHOD_INVOCATION);
21959
21960 /**
21961 * Led::handle-set-blink-fast:
21962 * @object: A #Led.
21963 * @invocation: A #GDBusMethodInvocation.
21964 *
21965 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
21966 *
21967 * 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.
21968 *
21969 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21970 */
21971 g_signal_new ("handle-set-blink-fast",
21972 G_TYPE_FROM_INTERFACE (iface),
21973 G_SIGNAL_RUN_LAST,
21974 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
21975 g_signal_accumulator_true_handled,
21976 NULL,
21977 g_cclosure_marshal_generic,
21978 G_TYPE_BOOLEAN,
21979 1,
21980 G_TYPE_DBUS_METHOD_INVOCATION);
21981
21982 /* GObject properties for D-Bus properties: */
21983 /**
21984 * Led:color:
21985 *
21986 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
21987 *
21988 * 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.
21989 */
21990 g_object_interface_install_property (iface,
21991 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21992 /**
21993 * Led:function:
21994 *
21995 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
21996 *
21997 * 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.
21998 */
21999 g_object_interface_install_property (iface,
22000 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22001}
22002
22003/**
22004 * led_get_color: (skip)
22005 * @object: A #Led.
22006 *
22007 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
22008 *
22009 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22010 *
22011 * Returns: The property value.
22012 */
22013gint
22014led_get_color (Led *object)
22015{
22016 return LED_GET_IFACE (object)->get_color (object);
22017}
22018
22019/**
22020 * led_set_color: (skip)
22021 * @object: A #Led.
22022 * @value: The value to set.
22023 *
22024 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
22025 *
22026 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22027 */
22028void
22029led_set_color (Led *object, gint value)
22030{
22031 g_object_set (G_OBJECT (object), "color", value, NULL);
22032}
22033
22034/**
22035 * led_get_function: (skip)
22036 * @object: A #Led.
22037 *
22038 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22039 *
22040 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22041 *
22042 * <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>
22043 *
22044 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22045 */
22046const gchar *
22047led_get_function (Led *object)
22048{
22049 return LED_GET_IFACE (object)->get_function (object);
22050}
22051
22052/**
22053 * led_dup_function: (skip)
22054 * @object: A #Led.
22055 *
22056 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22057 *
22058 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22059 *
22060 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22061 */
22062gchar *
22063led_dup_function (Led *object)
22064{
22065 gchar *value;
22066 g_object_get (G_OBJECT (object), "function", &value, NULL);
22067 return value;
22068}
22069
22070/**
22071 * led_set_function: (skip)
22072 * @object: A #Led.
22073 * @value: The value to set.
22074 *
22075 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
22076 *
22077 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22078 */
22079void
22080led_set_function (Led *object, const gchar *value)
22081{
22082 g_object_set (G_OBJECT (object), "function", value, NULL);
22083}
22084
22085/**
22086 * led_call_set_on:
22087 * @proxy: A #LedProxy.
22088 * @cancellable: (allow-none): A #GCancellable or %NULL.
22089 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22090 * @user_data: User data to pass to @callback.
22091 *
22092 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
22093 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22094 * You can then call led_call_set_on_finish() to get the result of the operation.
22095 *
22096 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
22097 */
22098void
22099led_call_set_on (
22100 Led *proxy,
22101 GCancellable *cancellable,
22102 GAsyncReadyCallback callback,
22103 gpointer user_data)
22104{
22105 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22106 "setOn",
22107 g_variant_new ("()"),
22108 G_DBUS_CALL_FLAGS_NONE,
22109 -1,
22110 cancellable,
22111 callback,
22112 user_data);
22113}
22114
22115/**
22116 * led_call_set_on_finish:
22117 * @proxy: A #LedProxy.
22118 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
22119 * @error: Return location for error or %NULL.
22120 *
22121 * Finishes an operation started with led_call_set_on().
22122 *
22123 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22124 */
22125gboolean
22126led_call_set_on_finish (
22127 Led *proxy,
22128 GAsyncResult *res,
22129 GError **error)
22130{
22131 GVariant *_ret;
22132 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22133 if (_ret == NULL)
22134 goto _out;
22135 g_variant_get (_ret,
22136 "()");
22137 g_variant_unref (_ret);
22138_out:
22139 return _ret != NULL;
22140}
22141
22142/**
22143 * led_call_set_on_sync:
22144 * @proxy: A #LedProxy.
22145 * @cancellable: (allow-none): A #GCancellable or %NULL.
22146 * @error: Return location for error or %NULL.
22147 *
22148 * 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.
22149 *
22150 * See led_call_set_on() for the asynchronous version of this method.
22151 *
22152 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22153 */
22154gboolean
22155led_call_set_on_sync (
22156 Led *proxy,
22157 GCancellable *cancellable,
22158 GError **error)
22159{
22160 GVariant *_ret;
22161 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22162 "setOn",
22163 g_variant_new ("()"),
22164 G_DBUS_CALL_FLAGS_NONE,
22165 -1,
22166 cancellable,
22167 error);
22168 if (_ret == NULL)
22169 goto _out;
22170 g_variant_get (_ret,
22171 "()");
22172 g_variant_unref (_ret);
22173_out:
22174 return _ret != NULL;
22175}
22176
22177/**
22178 * led_call_set_off:
22179 * @proxy: A #LedProxy.
22180 * @cancellable: (allow-none): A #GCancellable or %NULL.
22181 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22182 * @user_data: User data to pass to @callback.
22183 *
22184 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
22185 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22186 * You can then call led_call_set_off_finish() to get the result of the operation.
22187 *
22188 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
22189 */
22190void
22191led_call_set_off (
22192 Led *proxy,
22193 GCancellable *cancellable,
22194 GAsyncReadyCallback callback,
22195 gpointer user_data)
22196{
22197 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22198 "setOff",
22199 g_variant_new ("()"),
22200 G_DBUS_CALL_FLAGS_NONE,
22201 -1,
22202 cancellable,
22203 callback,
22204 user_data);
22205}
22206
22207/**
22208 * led_call_set_off_finish:
22209 * @proxy: A #LedProxy.
22210 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
22211 * @error: Return location for error or %NULL.
22212 *
22213 * Finishes an operation started with led_call_set_off().
22214 *
22215 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22216 */
22217gboolean
22218led_call_set_off_finish (
22219 Led *proxy,
22220 GAsyncResult *res,
22221 GError **error)
22222{
22223 GVariant *_ret;
22224 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22225 if (_ret == NULL)
22226 goto _out;
22227 g_variant_get (_ret,
22228 "()");
22229 g_variant_unref (_ret);
22230_out:
22231 return _ret != NULL;
22232}
22233
22234/**
22235 * led_call_set_off_sync:
22236 * @proxy: A #LedProxy.
22237 * @cancellable: (allow-none): A #GCancellable or %NULL.
22238 * @error: Return location for error or %NULL.
22239 *
22240 * 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.
22241 *
22242 * See led_call_set_off() for the asynchronous version of this method.
22243 *
22244 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22245 */
22246gboolean
22247led_call_set_off_sync (
22248 Led *proxy,
22249 GCancellable *cancellable,
22250 GError **error)
22251{
22252 GVariant *_ret;
22253 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22254 "setOff",
22255 g_variant_new ("()"),
22256 G_DBUS_CALL_FLAGS_NONE,
22257 -1,
22258 cancellable,
22259 error);
22260 if (_ret == NULL)
22261 goto _out;
22262 g_variant_get (_ret,
22263 "()");
22264 g_variant_unref (_ret);
22265_out:
22266 return _ret != NULL;
22267}
22268
22269/**
22270 * led_call_set_blink_slow:
22271 * @proxy: A #LedProxy.
22272 * @cancellable: (allow-none): A #GCancellable or %NULL.
22273 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22274 * @user_data: User data to pass to @callback.
22275 *
22276 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
22277 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22278 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
22279 *
22280 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
22281 */
22282void
22283led_call_set_blink_slow (
22284 Led *proxy,
22285 GCancellable *cancellable,
22286 GAsyncReadyCallback callback,
22287 gpointer user_data)
22288{
22289 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22290 "setBlinkSlow",
22291 g_variant_new ("()"),
22292 G_DBUS_CALL_FLAGS_NONE,
22293 -1,
22294 cancellable,
22295 callback,
22296 user_data);
22297}
22298
22299/**
22300 * led_call_set_blink_slow_finish:
22301 * @proxy: A #LedProxy.
22302 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
22303 * @error: Return location for error or %NULL.
22304 *
22305 * Finishes an operation started with led_call_set_blink_slow().
22306 *
22307 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22308 */
22309gboolean
22310led_call_set_blink_slow_finish (
22311 Led *proxy,
22312 GAsyncResult *res,
22313 GError **error)
22314{
22315 GVariant *_ret;
22316 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22317 if (_ret == NULL)
22318 goto _out;
22319 g_variant_get (_ret,
22320 "()");
22321 g_variant_unref (_ret);
22322_out:
22323 return _ret != NULL;
22324}
22325
22326/**
22327 * led_call_set_blink_slow_sync:
22328 * @proxy: A #LedProxy.
22329 * @cancellable: (allow-none): A #GCancellable or %NULL.
22330 * @error: Return location for error or %NULL.
22331 *
22332 * 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.
22333 *
22334 * See led_call_set_blink_slow() for the asynchronous version of this method.
22335 *
22336 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22337 */
22338gboolean
22339led_call_set_blink_slow_sync (
22340 Led *proxy,
22341 GCancellable *cancellable,
22342 GError **error)
22343{
22344 GVariant *_ret;
22345 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22346 "setBlinkSlow",
22347 g_variant_new ("()"),
22348 G_DBUS_CALL_FLAGS_NONE,
22349 -1,
22350 cancellable,
22351 error);
22352 if (_ret == NULL)
22353 goto _out;
22354 g_variant_get (_ret,
22355 "()");
22356 g_variant_unref (_ret);
22357_out:
22358 return _ret != NULL;
22359}
22360
22361/**
22362 * led_call_set_blink_fast:
22363 * @proxy: A #LedProxy.
22364 * @cancellable: (allow-none): A #GCancellable or %NULL.
22365 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22366 * @user_data: User data to pass to @callback.
22367 *
22368 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
22369 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22370 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
22371 *
22372 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
22373 */
22374void
22375led_call_set_blink_fast (
22376 Led *proxy,
22377 GCancellable *cancellable,
22378 GAsyncReadyCallback callback,
22379 gpointer user_data)
22380{
22381 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22382 "setBlinkFast",
22383 g_variant_new ("()"),
22384 G_DBUS_CALL_FLAGS_NONE,
22385 -1,
22386 cancellable,
22387 callback,
22388 user_data);
22389}
22390
22391/**
22392 * led_call_set_blink_fast_finish:
22393 * @proxy: A #LedProxy.
22394 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
22395 * @error: Return location for error or %NULL.
22396 *
22397 * Finishes an operation started with led_call_set_blink_fast().
22398 *
22399 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22400 */
22401gboolean
22402led_call_set_blink_fast_finish (
22403 Led *proxy,
22404 GAsyncResult *res,
22405 GError **error)
22406{
22407 GVariant *_ret;
22408 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22409 if (_ret == NULL)
22410 goto _out;
22411 g_variant_get (_ret,
22412 "()");
22413 g_variant_unref (_ret);
22414_out:
22415 return _ret != NULL;
22416}
22417
22418/**
22419 * led_call_set_blink_fast_sync:
22420 * @proxy: A #LedProxy.
22421 * @cancellable: (allow-none): A #GCancellable or %NULL.
22422 * @error: Return location for error or %NULL.
22423 *
22424 * 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.
22425 *
22426 * See led_call_set_blink_fast() for the asynchronous version of this method.
22427 *
22428 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22429 */
22430gboolean
22431led_call_set_blink_fast_sync (
22432 Led *proxy,
22433 GCancellable *cancellable,
22434 GError **error)
22435{
22436 GVariant *_ret;
22437 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22438 "setBlinkFast",
22439 g_variant_new ("()"),
22440 G_DBUS_CALL_FLAGS_NONE,
22441 -1,
22442 cancellable,
22443 error);
22444 if (_ret == NULL)
22445 goto _out;
22446 g_variant_get (_ret,
22447 "()");
22448 g_variant_unref (_ret);
22449_out:
22450 return _ret != NULL;
22451}
22452
22453/**
22454 * led_complete_set_on:
22455 * @object: A #Led.
22456 * @invocation: (transfer full): A #GDBusMethodInvocation.
22457 *
22458 * 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.
22459 *
22460 * This method will free @invocation, you cannot use it afterwards.
22461 */
22462void
22463led_complete_set_on (
22464 Led *object,
22465 GDBusMethodInvocation *invocation)
22466{
22467 g_dbus_method_invocation_return_value (invocation,
22468 g_variant_new ("()"));
22469}
22470
22471/**
22472 * led_complete_set_off:
22473 * @object: A #Led.
22474 * @invocation: (transfer full): A #GDBusMethodInvocation.
22475 *
22476 * 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.
22477 *
22478 * This method will free @invocation, you cannot use it afterwards.
22479 */
22480void
22481led_complete_set_off (
22482 Led *object,
22483 GDBusMethodInvocation *invocation)
22484{
22485 g_dbus_method_invocation_return_value (invocation,
22486 g_variant_new ("()"));
22487}
22488
22489/**
22490 * led_complete_set_blink_slow:
22491 * @object: A #Led.
22492 * @invocation: (transfer full): A #GDBusMethodInvocation.
22493 *
22494 * 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.
22495 *
22496 * This method will free @invocation, you cannot use it afterwards.
22497 */
22498void
22499led_complete_set_blink_slow (
22500 Led *object,
22501 GDBusMethodInvocation *invocation)
22502{
22503 g_dbus_method_invocation_return_value (invocation,
22504 g_variant_new ("()"));
22505}
22506
22507/**
22508 * led_complete_set_blink_fast:
22509 * @object: A #Led.
22510 * @invocation: (transfer full): A #GDBusMethodInvocation.
22511 *
22512 * 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.
22513 *
22514 * This method will free @invocation, you cannot use it afterwards.
22515 */
22516void
22517led_complete_set_blink_fast (
22518 Led *object,
22519 GDBusMethodInvocation *invocation)
22520{
22521 g_dbus_method_invocation_return_value (invocation,
22522 g_variant_new ("()"));
22523}
22524
22525/* ------------------------------------------------------------------------ */
22526
22527/**
22528 * LedProxy:
22529 *
22530 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
22531 */
22532
22533/**
22534 * LedProxyClass:
22535 * @parent_class: The parent class.
22536 *
22537 * Class structure for #LedProxy.
22538 */
22539
22540struct _LedProxyPrivate
22541{
22542 GData *qdata;
22543};
22544
22545static void led_proxy_iface_init (LedIface *iface);
22546
22547#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22548G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22549 G_ADD_PRIVATE (LedProxy)
22550 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22551
22552#else
22553G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22554 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22555
22556#endif
22557static void
22558led_proxy_finalize (GObject *object)
22559{
22560 LedProxy *proxy = LED_PROXY (object);
22561 g_datalist_clear (&proxy->priv->qdata);
22562 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
22563}
22564
22565static void
22566led_proxy_get_property (GObject *object,
22567 guint prop_id,
22568 GValue *value,
22569 GParamSpec *pspec G_GNUC_UNUSED)
22570{
22571 const _ExtendedGDBusPropertyInfo *info;
22572 GVariant *variant;
22573 g_assert (prop_id != 0 && prop_id - 1 < 2);
22574 info = _led_property_info_pointers[prop_id - 1];
22575 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22576 if (info->use_gvariant)
22577 {
22578 g_value_set_variant (value, variant);
22579 }
22580 else
22581 {
22582 if (variant != NULL)
22583 g_dbus_gvariant_to_gvalue (variant, value);
22584 }
22585 if (variant != NULL)
22586 g_variant_unref (variant);
22587}
22588
22589static void
22590led_proxy_set_property_cb (GDBusProxy *proxy,
22591 GAsyncResult *res,
22592 gpointer user_data)
22593{
22594 const _ExtendedGDBusPropertyInfo *info = user_data;
22595 GError *error;
22596 GVariant *_ret;
22597 error = NULL;
22598 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22599 if (!_ret)
22600 {
22601 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
22602 info->parent_struct.name,
22603 error->message, g_quark_to_string (error->domain), error->code);
22604 g_error_free (error);
22605 }
22606 else
22607 {
22608 g_variant_unref (_ret);
22609 }
22610}
22611
22612static void
22613led_proxy_set_property (GObject *object,
22614 guint prop_id,
22615 const GValue *value,
22616 GParamSpec *pspec G_GNUC_UNUSED)
22617{
22618 const _ExtendedGDBusPropertyInfo *info;
22619 GVariant *variant;
22620 g_assert (prop_id != 0 && prop_id - 1 < 2);
22621 info = _led_property_info_pointers[prop_id - 1];
22622 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22623 g_dbus_proxy_call (G_DBUS_PROXY (object),
22624 "org.freedesktop.DBus.Properties.Set",
22625 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
22626 G_DBUS_CALL_FLAGS_NONE,
22627 -1,
22628 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22629 g_variant_unref (variant);
22630}
22631
22632static void
22633led_proxy_g_signal (GDBusProxy *proxy,
22634 const gchar *sender_name G_GNUC_UNUSED,
22635 const gchar *signal_name,
22636 GVariant *parameters)
22637{
22638 _ExtendedGDBusSignalInfo *info;
22639 GVariantIter iter;
22640 GVariant *child;
22641 GValue *paramv;
22642 guint num_params;
22643 guint n;
22644 guint signal_id;
22645 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
22646 if (info == NULL)
22647 return;
22648 num_params = g_variant_n_children (parameters);
22649 paramv = g_new0 (GValue, num_params + 1);
22650 g_value_init (&paramv[0], TYPE_LED);
22651 g_value_set_object (&paramv[0], proxy);
22652 g_variant_iter_init (&iter, parameters);
22653 n = 1;
22654 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22655 {
22656 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22657 if (arg_info->use_gvariant)
22658 {
22659 g_value_init (&paramv[n], G_TYPE_VARIANT);
22660 g_value_set_variant (&paramv[n], child);
22661 n++;
22662 }
22663 else
22664 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22665 g_variant_unref (child);
22666 }
22667 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
22668 g_signal_emitv (paramv, signal_id, 0, NULL);
22669 for (n = 0; n < num_params + 1; n++)
22670 g_value_unset (&paramv[n]);
22671 g_free (paramv);
22672}
22673
22674static void
22675led_proxy_g_properties_changed (GDBusProxy *_proxy,
22676 GVariant *changed_properties,
22677 const gchar *const *invalidated_properties)
22678{
22679 LedProxy *proxy = LED_PROXY (_proxy);
22680 guint n;
22681 const gchar *key;
22682 GVariantIter *iter;
22683 _ExtendedGDBusPropertyInfo *info;
22684 g_variant_get (changed_properties, "a{sv}", &iter);
22685 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22686 {
22687 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
22688 g_datalist_remove_data (&proxy->priv->qdata, key);
22689 if (info != NULL)
22690 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22691 }
22692 g_variant_iter_free (iter);
22693 for (n = 0; invalidated_properties[n] != NULL; n++)
22694 {
22695 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
22696 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
22697 if (info != NULL)
22698 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22699 }
22700}
22701
22702static gint
22703led_proxy_get_color (Led *object)
22704{
22705 LedProxy *proxy = LED_PROXY (object);
22706 GVariant *variant;
22707 gint value = 0;
22708 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
22709 if (variant != NULL)
22710 {
22711 value = g_variant_get_int32 (variant);
22712 g_variant_unref (variant);
22713 }
22714 return value;
22715}
22716
22717static const gchar *
22718led_proxy_get_function (Led *object)
22719{
22720 LedProxy *proxy = LED_PROXY (object);
22721 GVariant *variant;
22722 const gchar *value = NULL;
22723 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
22724 if (variant != NULL)
22725 {
22726 value = g_variant_get_string (variant, NULL);
22727 g_variant_unref (variant);
22728 }
22729 return value;
22730}
22731
22732static void
22733led_proxy_init (LedProxy *proxy)
22734{
22735#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22736 proxy->priv = led_proxy_get_instance_private (proxy);
22737#else
22738 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
22739#endif
22740
22741 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
22742}
22743
22744static void
22745led_proxy_class_init (LedProxyClass *klass)
22746{
22747 GObjectClass *gobject_class;
22748 GDBusProxyClass *proxy_class;
22749
22750 gobject_class = G_OBJECT_CLASS (klass);
22751 gobject_class->finalize = led_proxy_finalize;
22752 gobject_class->get_property = led_proxy_get_property;
22753 gobject_class->set_property = led_proxy_set_property;
22754
22755 proxy_class = G_DBUS_PROXY_CLASS (klass);
22756 proxy_class->g_signal = led_proxy_g_signal;
22757 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
22758
22759 led_override_properties (gobject_class, 1);
22760
22761#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22762 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
22763#endif
22764}
22765
22766static void
22767led_proxy_iface_init (LedIface *iface)
22768{
22769 iface->get_color = led_proxy_get_color;
22770 iface->get_function = led_proxy_get_function;
22771}
22772
22773/**
22774 * led_proxy_new:
22775 * @connection: A #GDBusConnection.
22776 * @flags: Flags from the #GDBusProxyFlags enumeration.
22777 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22778 * @object_path: An object path.
22779 * @cancellable: (allow-none): A #GCancellable or %NULL.
22780 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22781 * @user_data: User data to pass to @callback.
22782 *
22783 * 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.
22784 *
22785 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22786 * You can then call led_proxy_new_finish() to get the result of the operation.
22787 *
22788 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
22789 */
22790void
22791led_proxy_new (
22792 GDBusConnection *connection,
22793 GDBusProxyFlags flags,
22794 const gchar *name,
22795 const gchar *object_path,
22796 GCancellable *cancellable,
22797 GAsyncReadyCallback callback,
22798 gpointer user_data)
22799{
22800 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);
22801}
22802
22803/**
22804 * led_proxy_new_finish:
22805 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
22806 * @error: Return location for error or %NULL
22807 *
22808 * Finishes an operation started with led_proxy_new().
22809 *
22810 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22811 */
22812Led *
22813led_proxy_new_finish (
22814 GAsyncResult *res,
22815 GError **error)
22816{
22817 GObject *ret;
22818 GObject *source_object;
22819 source_object = g_async_result_get_source_object (res);
22820 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22821 g_object_unref (source_object);
22822 if (ret != NULL)
22823 return LED (ret);
22824 else
22825 return NULL;
22826}
22827
22828/**
22829 * led_proxy_new_sync:
22830 * @connection: A #GDBusConnection.
22831 * @flags: Flags from the #GDBusProxyFlags enumeration.
22832 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22833 * @object_path: An object path.
22834 * @cancellable: (allow-none): A #GCancellable or %NULL.
22835 * @error: Return location for error or %NULL
22836 *
22837 * 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.
22838 *
22839 * The calling thread is blocked until a reply is received.
22840 *
22841 * See led_proxy_new() for the asynchronous version of this constructor.
22842 *
22843 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22844 */
22845Led *
22846led_proxy_new_sync (
22847 GDBusConnection *connection,
22848 GDBusProxyFlags flags,
22849 const gchar *name,
22850 const gchar *object_path,
22851 GCancellable *cancellable,
22852 GError **error)
22853{
22854 GInitable *ret;
22855 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);
22856 if (ret != NULL)
22857 return LED (ret);
22858 else
22859 return NULL;
22860}
22861
22862
22863/**
22864 * led_proxy_new_for_bus:
22865 * @bus_type: A #GBusType.
22866 * @flags: Flags from the #GDBusProxyFlags enumeration.
22867 * @name: A bus name (well-known or unique).
22868 * @object_path: An object path.
22869 * @cancellable: (allow-none): A #GCancellable or %NULL.
22870 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22871 * @user_data: User data to pass to @callback.
22872 *
22873 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
22874 *
22875 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22876 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
22877 *
22878 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
22879 */
22880void
22881led_proxy_new_for_bus (
22882 GBusType bus_type,
22883 GDBusProxyFlags flags,
22884 const gchar *name,
22885 const gchar *object_path,
22886 GCancellable *cancellable,
22887 GAsyncReadyCallback callback,
22888 gpointer user_data)
22889{
22890 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);
22891}
22892
22893/**
22894 * led_proxy_new_for_bus_finish:
22895 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
22896 * @error: Return location for error or %NULL
22897 *
22898 * Finishes an operation started with led_proxy_new_for_bus().
22899 *
22900 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22901 */
22902Led *
22903led_proxy_new_for_bus_finish (
22904 GAsyncResult *res,
22905 GError **error)
22906{
22907 GObject *ret;
22908 GObject *source_object;
22909 source_object = g_async_result_get_source_object (res);
22910 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22911 g_object_unref (source_object);
22912 if (ret != NULL)
22913 return LED (ret);
22914 else
22915 return NULL;
22916}
22917
22918/**
22919 * led_proxy_new_for_bus_sync:
22920 * @bus_type: A #GBusType.
22921 * @flags: Flags from the #GDBusProxyFlags enumeration.
22922 * @name: A bus name (well-known or unique).
22923 * @object_path: An object path.
22924 * @cancellable: (allow-none): A #GCancellable or %NULL.
22925 * @error: Return location for error or %NULL
22926 *
22927 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
22928 *
22929 * The calling thread is blocked until a reply is received.
22930 *
22931 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
22932 *
22933 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22934 */
22935Led *
22936led_proxy_new_for_bus_sync (
22937 GBusType bus_type,
22938 GDBusProxyFlags flags,
22939 const gchar *name,
22940 const gchar *object_path,
22941 GCancellable *cancellable,
22942 GError **error)
22943{
22944 GInitable *ret;
22945 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);
22946 if (ret != NULL)
22947 return LED (ret);
22948 else
22949 return NULL;
22950}
22951
22952
22953/* ------------------------------------------------------------------------ */
22954
22955/**
22956 * LedSkeleton:
22957 *
22958 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
22959 */
22960
22961/**
22962 * LedSkeletonClass:
22963 * @parent_class: The parent class.
22964 *
22965 * Class structure for #LedSkeleton.
22966 */
22967
22968struct _LedSkeletonPrivate
22969{
22970 GValue *properties;
22971 GList *changed_properties;
22972 GSource *changed_properties_idle_source;
22973 GMainContext *context;
22974 GMutex lock;
22975};
22976
22977static void
22978_led_skeleton_handle_method_call (
22979 GDBusConnection *connection G_GNUC_UNUSED,
22980 const gchar *sender G_GNUC_UNUSED,
22981 const gchar *object_path G_GNUC_UNUSED,
22982 const gchar *interface_name,
22983 const gchar *method_name,
22984 GVariant *parameters,
22985 GDBusMethodInvocation *invocation,
22986 gpointer user_data)
22987{
22988 LedSkeleton *skeleton = LED_SKELETON (user_data);
22989 _ExtendedGDBusMethodInfo *info;
22990 GVariantIter iter;
22991 GVariant *child;
22992 GValue *paramv;
22993 guint num_params;
22994 guint num_extra;
22995 guint n;
22996 guint signal_id;
22997 GValue return_value = G_VALUE_INIT;
22998 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
22999 g_assert (info != NULL);
23000 num_params = g_variant_n_children (parameters);
23001 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23002 n = 0;
23003 g_value_init (&paramv[n], TYPE_LED);
23004 g_value_set_object (&paramv[n++], skeleton);
23005 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23006 g_value_set_object (&paramv[n++], invocation);
23007 if (info->pass_fdlist)
23008 {
23009#ifdef G_OS_UNIX
23010 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23011 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23012#else
23013 g_assert_not_reached ();
23014#endif
23015 }
23016 g_variant_iter_init (&iter, parameters);
23017 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23018 {
23019 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23020 if (arg_info->use_gvariant)
23021 {
23022 g_value_init (&paramv[n], G_TYPE_VARIANT);
23023 g_value_set_variant (&paramv[n], child);
23024 n++;
23025 }
23026 else
23027 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23028 g_variant_unref (child);
23029 }
23030 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
23031 g_value_init (&return_value, G_TYPE_BOOLEAN);
23032 g_signal_emitv (paramv, signal_id, 0, &return_value);
23033 if (!g_value_get_boolean (&return_value))
23034 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);
23035 g_value_unset (&return_value);
23036 for (n = 0; n < num_params + num_extra; n++)
23037 g_value_unset (&paramv[n]);
23038 g_free (paramv);
23039}
23040
23041static GVariant *
23042_led_skeleton_handle_get_property (
23043 GDBusConnection *connection G_GNUC_UNUSED,
23044 const gchar *sender G_GNUC_UNUSED,
23045 const gchar *object_path G_GNUC_UNUSED,
23046 const gchar *interface_name G_GNUC_UNUSED,
23047 const gchar *property_name,
23048 GError **error,
23049 gpointer user_data)
23050{
23051 LedSkeleton *skeleton = LED_SKELETON (user_data);
23052 GValue value = G_VALUE_INIT;
23053 GParamSpec *pspec;
23054 _ExtendedGDBusPropertyInfo *info;
23055 GVariant *ret;
23056 ret = NULL;
23057 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
23058 g_assert (info != NULL);
23059 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23060 if (pspec == NULL)
23061 {
23062 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23063 }
23064 else
23065 {
23066 g_value_init (&value, pspec->value_type);
23067 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23068 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23069 g_value_unset (&value);
23070 }
23071 return ret;
23072}
23073
23074static gboolean
23075_led_skeleton_handle_set_property (
23076 GDBusConnection *connection G_GNUC_UNUSED,
23077 const gchar *sender G_GNUC_UNUSED,
23078 const gchar *object_path G_GNUC_UNUSED,
23079 const gchar *interface_name G_GNUC_UNUSED,
23080 const gchar *property_name,
23081 GVariant *variant,
23082 GError **error,
23083 gpointer user_data)
23084{
23085 LedSkeleton *skeleton = LED_SKELETON (user_data);
23086 GValue value = G_VALUE_INIT;
23087 GParamSpec *pspec;
23088 _ExtendedGDBusPropertyInfo *info;
23089 gboolean ret;
23090 ret = FALSE;
23091 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
23092 g_assert (info != NULL);
23093 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23094 if (pspec == NULL)
23095 {
23096 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23097 }
23098 else
23099 {
23100 if (info->use_gvariant)
23101 g_value_set_variant (&value, variant);
23102 else
23103 g_dbus_gvariant_to_gvalue (variant, &value);
23104 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23105 g_value_unset (&value);
23106 ret = TRUE;
23107 }
23108 return ret;
23109}
23110
23111static const GDBusInterfaceVTable _led_skeleton_vtable =
23112{
23113 _led_skeleton_handle_method_call,
23114 _led_skeleton_handle_get_property,
23115 _led_skeleton_handle_set_property,
23116 {NULL}
23117};
23118
23119static GDBusInterfaceInfo *
23120led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23121{
23122 return led_interface_info ();
23123}
23124
23125static GDBusInterfaceVTable *
23126led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23127{
23128 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
23129}
23130
23131static GVariant *
23132led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23133{
23134 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
23135
23136 GVariantBuilder builder;
23137 guint n;
23138 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23139 if (_led_interface_info.parent_struct.properties == NULL)
23140 goto out;
23141 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
23142 {
23143 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
23144 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23145 {
23146 GVariant *value;
23147 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);
23148 if (value != NULL)
23149 {
23150 g_variant_take_ref (value);
23151 g_variant_builder_add (&builder, "{sv}", info->name, value);
23152 g_variant_unref (value);
23153 }
23154 }
23155 }
23156out:
23157 return g_variant_builder_end (&builder);
23158}
23159
23160static gboolean _led_emit_changed (gpointer user_data);
23161
23162static void
23163led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23164{
23165 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
23166 gboolean emit_changed = FALSE;
23167
23168 g_mutex_lock (&skeleton->priv->lock);
23169 if (skeleton->priv->changed_properties_idle_source != NULL)
23170 {
23171 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23172 skeleton->priv->changed_properties_idle_source = NULL;
23173 emit_changed = TRUE;
23174 }
23175 g_mutex_unlock (&skeleton->priv->lock);
23176
23177 if (emit_changed)
23178 _led_emit_changed (skeleton);
23179}
23180
23181static void led_skeleton_iface_init (LedIface *iface);
23182#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23183G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23184 G_ADD_PRIVATE (LedSkeleton)
23185 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
23186
23187#else
23188G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23189 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
23190
23191#endif
23192static void
23193led_skeleton_finalize (GObject *object)
23194{
23195 LedSkeleton *skeleton = LED_SKELETON (object);
23196 guint n;
23197 for (n = 0; n < 2; n++)
23198 g_value_unset (&skeleton->priv->properties[n]);
23199 g_free (skeleton->priv->properties);
23200 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23201 if (skeleton->priv->changed_properties_idle_source != NULL)
23202 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23203 g_main_context_unref (skeleton->priv->context);
23204 g_mutex_clear (&skeleton->priv->lock);
23205 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
23206}
23207
23208static void
23209led_skeleton_get_property (GObject *object,
23210 guint prop_id,
23211 GValue *value,
23212 GParamSpec *pspec G_GNUC_UNUSED)
23213{
23214 LedSkeleton *skeleton = LED_SKELETON (object);
23215 g_assert (prop_id != 0 && prop_id - 1 < 2);
23216 g_mutex_lock (&skeleton->priv->lock);
23217 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23218 g_mutex_unlock (&skeleton->priv->lock);
23219}
23220
23221static gboolean
23222_led_emit_changed (gpointer user_data)
23223{
23224 LedSkeleton *skeleton = LED_SKELETON (user_data);
23225 GList *l;
23226 GVariantBuilder builder;
23227 GVariantBuilder invalidated_builder;
23228 guint num_changes;
23229
23230 g_mutex_lock (&skeleton->priv->lock);
23231 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23232 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23233 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23234 {
23235 ChangedProperty *cp = l->data;
23236 GVariant *variant;
23237 const GValue *cur_value;
23238
23239 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23240 if (!_g_value_equal (cur_value, &cp->orig_value))
23241 {
23242 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23243 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23244 g_variant_unref (variant);
23245 num_changes++;
23246 }
23247 }
23248 if (num_changes > 0)
23249 {
23250 GList *connections, *ll;
23251 GVariant *signal_variant;
23252 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
23253 &builder, &invalidated_builder));
23254 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23255 for (ll = connections; ll != NULL; ll = ll->next)
23256 {
23257 GDBusConnection *connection = ll->data;
23258
23259 g_dbus_connection_emit_signal (connection,
23260 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23261 "org.freedesktop.DBus.Properties",
23262 "PropertiesChanged",
23263 signal_variant,
23264 NULL);
23265 }
23266 g_variant_unref (signal_variant);
23267 g_list_free_full (connections, g_object_unref);
23268 }
23269 else
23270 {
23271 g_variant_builder_clear (&builder);
23272 g_variant_builder_clear (&invalidated_builder);
23273 }
23274 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23275 skeleton->priv->changed_properties = NULL;
23276 skeleton->priv->changed_properties_idle_source = NULL;
23277 g_mutex_unlock (&skeleton->priv->lock);
23278 return FALSE;
23279}
23280
23281static void
23282_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23283{
23284 ChangedProperty *cp;
23285 GList *l;
23286 cp = NULL;
23287 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23288 {
23289 ChangedProperty *i_cp = l->data;
23290 if (i_cp->info == info)
23291 {
23292 cp = i_cp;
23293 break;
23294 }
23295 }
23296 if (cp == NULL)
23297 {
23298 cp = g_new0 (ChangedProperty, 1);
23299 cp->prop_id = prop_id;
23300 cp->info = info;
23301 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23302 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23303 g_value_copy (orig_value, &cp->orig_value);
23304 }
23305}
23306
23307static void
23308led_skeleton_notify (GObject *object,
23309 GParamSpec *pspec G_GNUC_UNUSED)
23310{
23311 LedSkeleton *skeleton = LED_SKELETON (object);
23312 g_mutex_lock (&skeleton->priv->lock);
23313 if (skeleton->priv->changed_properties != NULL &&
23314 skeleton->priv->changed_properties_idle_source == NULL)
23315 {
23316 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23317 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23318 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23319 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23320 g_source_unref (skeleton->priv->changed_properties_idle_source);
23321 }
23322 g_mutex_unlock (&skeleton->priv->lock);
23323}
23324
23325static void
23326led_skeleton_set_property (GObject *object,
23327 guint prop_id,
23328 const GValue *value,
23329 GParamSpec *pspec)
23330{
23331 LedSkeleton *skeleton = LED_SKELETON (object);
23332 g_assert (prop_id != 0 && prop_id - 1 < 2);
23333 g_mutex_lock (&skeleton->priv->lock);
23334 g_object_freeze_notify (object);
23335 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23336 {
23337 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23338 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23339 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23340 g_object_notify_by_pspec (object, pspec);
23341 }
23342 g_mutex_unlock (&skeleton->priv->lock);
23343 g_object_thaw_notify (object);
23344}
23345
23346static void
23347led_skeleton_init (LedSkeleton *skeleton)
23348{
23349#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23350 skeleton->priv = led_skeleton_get_instance_private (skeleton);
23351#else
23352 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
23353#endif
23354
23355 g_mutex_init (&skeleton->priv->lock);
23356 skeleton->priv->context = g_main_context_ref_thread_default ();
23357 skeleton->priv->properties = g_new0 (GValue, 2);
23358 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
23359 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23360}
23361
23362static gint
23363led_skeleton_get_color (Led *object)
23364{
23365 LedSkeleton *skeleton = LED_SKELETON (object);
23366 gint value;
23367 g_mutex_lock (&skeleton->priv->lock);
23368 value = g_value_get_int (&(skeleton->priv->properties[0]));
23369 g_mutex_unlock (&skeleton->priv->lock);
23370 return value;
23371}
23372
23373static const gchar *
23374led_skeleton_get_function (Led *object)
23375{
23376 LedSkeleton *skeleton = LED_SKELETON (object);
23377 const gchar *value;
23378 g_mutex_lock (&skeleton->priv->lock);
23379 value = g_value_get_string (&(skeleton->priv->properties[1]));
23380 g_mutex_unlock (&skeleton->priv->lock);
23381 return value;
23382}
23383
23384static void
23385led_skeleton_class_init (LedSkeletonClass *klass)
23386{
23387 GObjectClass *gobject_class;
23388 GDBusInterfaceSkeletonClass *skeleton_class;
23389
23390 gobject_class = G_OBJECT_CLASS (klass);
23391 gobject_class->finalize = led_skeleton_finalize;
23392 gobject_class->get_property = led_skeleton_get_property;
23393 gobject_class->set_property = led_skeleton_set_property;
23394 gobject_class->notify = led_skeleton_notify;
23395
23396
23397 led_override_properties (gobject_class, 1);
23398
23399 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23400 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
23401 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
23402 skeleton_class->flush = led_skeleton_dbus_interface_flush;
23403 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
23404
23405#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23406 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
23407#endif
23408}
23409
23410static void
23411led_skeleton_iface_init (LedIface *iface)
23412{
23413 iface->get_color = led_skeleton_get_color;
23414 iface->get_function = led_skeleton_get_function;
23415}
23416
23417/**
23418 * led_skeleton_new:
23419 *
23420 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
23421 *
23422 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
23423 */
23424Led *
23425led_skeleton_new (void)
23426{
23427 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
23428}
23429
23430/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023431 * Code for interface org.openbmc.HostIpmi
23432 * ------------------------------------------------------------------------
23433 */
23434
23435/**
23436 * SECTION:HostIpmi
23437 * @title: HostIpmi
23438 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
23439 *
23440 * 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.
23441 */
23442
23443/* ---- Introspection data for org.openbmc.HostIpmi ---- */
23444
23445static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
23446{
23447 {
23448 -1,
23449 (gchar *) "seq",
23450 (gchar *) "y",
23451 NULL
23452 },
23453 FALSE
23454};
23455
23456static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
23457{
23458 {
23459 -1,
23460 (gchar *) "netfn",
23461 (gchar *) "y",
23462 NULL
23463 },
23464 FALSE
23465};
23466
23467static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
23468{
23469 {
23470 -1,
23471 (gchar *) "cmd",
23472 (gchar *) "y",
23473 NULL
23474 },
23475 FALSE
23476};
23477
23478static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
23479{
23480 {
23481 -1,
23482 (gchar *) "data",
23483 (gchar *) "ay",
23484 NULL
23485 },
23486 FALSE
23487};
23488
23489static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
23490{
23491 &_host_ipmi_method_info_send_message_IN_ARG_seq,
23492 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
23493 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
23494 &_host_ipmi_method_info_send_message_IN_ARG_data,
23495 NULL
23496};
23497
23498static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
23499{
23500 {
23501 -1,
23502 (gchar *) "unnamed_arg4",
23503 (gchar *) "x",
23504 NULL
23505 },
23506 FALSE
23507};
23508
23509static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
23510{
23511 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
23512 NULL
23513};
23514
23515static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
23516{
23517 {
23518 -1,
23519 (gchar *) "sendMessage",
23520 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
23521 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
23522 NULL
23523 },
23524 "handle-send-message",
23525 FALSE
23526};
23527
23528static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
23529{
23530 &_host_ipmi_method_info_send_message,
23531 NULL
23532};
23533
23534static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
23535{
23536 {
23537 -1,
23538 (gchar *) "seq",
23539 (gchar *) "y",
23540 NULL
23541 },
23542 FALSE
23543};
23544
23545static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
23546{
23547 {
23548 -1,
23549 (gchar *) "netfn",
23550 (gchar *) "y",
23551 NULL
23552 },
23553 FALSE
23554};
23555
23556static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
23557{
23558 {
23559 -1,
23560 (gchar *) "cmd",
23561 (gchar *) "y",
23562 NULL
23563 },
23564 FALSE
23565};
23566
23567static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
23568{
23569 {
23570 -1,
23571 (gchar *) "data",
23572 (gchar *) "ay",
23573 NULL
23574 },
23575 FALSE
23576};
23577
23578static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
23579{
23580 &_host_ipmi_signal_info_received_message_ARG_seq,
23581 &_host_ipmi_signal_info_received_message_ARG_netfn,
23582 &_host_ipmi_signal_info_received_message_ARG_cmd,
23583 &_host_ipmi_signal_info_received_message_ARG_data,
23584 NULL
23585};
23586
23587static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
23588{
23589 {
23590 -1,
23591 (gchar *) "ReceivedMessage",
23592 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
23593 NULL
23594 },
23595 "received-message"
23596};
23597
23598static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
23599{
23600 &_host_ipmi_signal_info_received_message,
23601 NULL
23602};
23603
23604static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
23605{
23606 {
23607 -1,
23608 (gchar *) "org.openbmc.HostIpmi",
23609 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
23610 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
23611 NULL,
23612 NULL
23613 },
23614 "host-ipmi",
23615};
23616
23617
23618/**
23619 * host_ipmi_interface_info:
23620 *
23621 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
23622 *
23623 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
23624 */
23625GDBusInterfaceInfo *
23626host_ipmi_interface_info (void)
23627{
23628 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
23629}
23630
23631/**
23632 * host_ipmi_override_properties:
23633 * @klass: The class structure for a #GObject<!-- -->-derived class.
23634 * @property_id_begin: The property id to assign to the first overridden property.
23635 *
23636 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
23637 * The properties are overridden in the order they are defined.
23638 *
23639 * Returns: The last property id.
23640 */
23641guint
23642host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
23643{
23644 return property_id_begin - 1;
23645}
23646
23647
23648
23649/**
23650 * HostIpmi:
23651 *
23652 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
23653 */
23654
23655/**
23656 * HostIpmiIface:
23657 * @parent_iface: The parent interface.
23658 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
23659 * @received_message: Handler for the #HostIpmi::received-message signal.
23660 *
23661 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
23662 */
23663
23664typedef HostIpmiIface HostIpmiInterface;
23665G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
23666
23667static void
23668host_ipmi_default_init (HostIpmiIface *iface)
23669{
23670 /* GObject signals for incoming D-Bus method calls: */
23671 /**
23672 * HostIpmi::handle-send-message:
23673 * @object: A #HostIpmi.
23674 * @invocation: A #GDBusMethodInvocation.
23675 * @arg_seq: Argument passed by remote caller.
23676 * @arg_netfn: Argument passed by remote caller.
23677 * @arg_cmd: Argument passed by remote caller.
23678 * @arg_data: Argument passed by remote caller.
23679 *
23680 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
23681 *
23682 * 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.
23683 *
23684 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
23685 */
23686 g_signal_new ("handle-send-message",
23687 G_TYPE_FROM_INTERFACE (iface),
23688 G_SIGNAL_RUN_LAST,
23689 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
23690 g_signal_accumulator_true_handled,
23691 NULL,
23692 g_cclosure_marshal_generic,
23693 G_TYPE_BOOLEAN,
23694 5,
23695 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
23696
23697 /* GObject signals for received D-Bus signals: */
23698 /**
23699 * HostIpmi::received-message:
23700 * @object: A #HostIpmi.
23701 * @arg_seq: Argument.
23702 * @arg_netfn: Argument.
23703 * @arg_cmd: Argument.
23704 * @arg_data: Argument.
23705 *
23706 * 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.
23707 *
23708 * 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.
23709 */
23710 g_signal_new ("received-message",
23711 G_TYPE_FROM_INTERFACE (iface),
23712 G_SIGNAL_RUN_LAST,
23713 G_STRUCT_OFFSET (HostIpmiIface, received_message),
23714 NULL,
23715 NULL,
23716 g_cclosure_marshal_generic,
23717 G_TYPE_NONE,
23718 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
23719
23720}
23721
23722/**
23723 * host_ipmi_emit_received_message:
23724 * @object: A #HostIpmi.
23725 * @arg_seq: Argument to pass with the signal.
23726 * @arg_netfn: Argument to pass with the signal.
23727 * @arg_cmd: Argument to pass with the signal.
23728 * @arg_data: Argument to pass with the signal.
23729 *
23730 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
23731 */
23732void
23733host_ipmi_emit_received_message (
23734 HostIpmi *object,
23735 guchar arg_seq,
23736 guchar arg_netfn,
23737 guchar arg_cmd,
23738 const gchar *arg_data)
23739{
23740 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
23741}
23742
23743/**
23744 * host_ipmi_call_send_message:
23745 * @proxy: A #HostIpmiProxy.
23746 * @arg_seq: Argument to pass with the method invocation.
23747 * @arg_netfn: Argument to pass with the method invocation.
23748 * @arg_cmd: Argument to pass with the method invocation.
23749 * @arg_data: Argument to pass with the method invocation.
23750 * @cancellable: (allow-none): A #GCancellable or %NULL.
23751 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23752 * @user_data: User data to pass to @callback.
23753 *
23754 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
23755 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23756 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
23757 *
23758 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
23759 */
23760void
23761host_ipmi_call_send_message (
23762 HostIpmi *proxy,
23763 guchar arg_seq,
23764 guchar arg_netfn,
23765 guchar arg_cmd,
23766 const gchar *arg_data,
23767 GCancellable *cancellable,
23768 GAsyncReadyCallback callback,
23769 gpointer user_data)
23770{
23771 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23772 "sendMessage",
23773 g_variant_new ("(yyy^ay)",
23774 arg_seq,
23775 arg_netfn,
23776 arg_cmd,
23777 arg_data),
23778 G_DBUS_CALL_FLAGS_NONE,
23779 -1,
23780 cancellable,
23781 callback,
23782 user_data);
23783}
23784
23785/**
23786 * host_ipmi_call_send_message_finish:
23787 * @proxy: A #HostIpmiProxy.
23788 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
23789 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
23790 * @error: Return location for error or %NULL.
23791 *
23792 * Finishes an operation started with host_ipmi_call_send_message().
23793 *
23794 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23795 */
23796gboolean
23797host_ipmi_call_send_message_finish (
23798 HostIpmi *proxy,
23799 gint64 *out_unnamed_arg4,
23800 GAsyncResult *res,
23801 GError **error)
23802{
23803 GVariant *_ret;
23804 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23805 if (_ret == NULL)
23806 goto _out;
23807 g_variant_get (_ret,
23808 "(x)",
23809 out_unnamed_arg4);
23810 g_variant_unref (_ret);
23811_out:
23812 return _ret != NULL;
23813}
23814
23815/**
23816 * host_ipmi_call_send_message_sync:
23817 * @proxy: A #HostIpmiProxy.
23818 * @arg_seq: Argument to pass with the method invocation.
23819 * @arg_netfn: Argument to pass with the method invocation.
23820 * @arg_cmd: Argument to pass with the method invocation.
23821 * @arg_data: Argument to pass with the method invocation.
23822 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
23823 * @cancellable: (allow-none): A #GCancellable or %NULL.
23824 * @error: Return location for error or %NULL.
23825 *
23826 * 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.
23827 *
23828 * See host_ipmi_call_send_message() for the asynchronous version of this method.
23829 *
23830 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23831 */
23832gboolean
23833host_ipmi_call_send_message_sync (
23834 HostIpmi *proxy,
23835 guchar arg_seq,
23836 guchar arg_netfn,
23837 guchar arg_cmd,
23838 const gchar *arg_data,
23839 gint64 *out_unnamed_arg4,
23840 GCancellable *cancellable,
23841 GError **error)
23842{
23843 GVariant *_ret;
23844 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23845 "sendMessage",
23846 g_variant_new ("(yyy^ay)",
23847 arg_seq,
23848 arg_netfn,
23849 arg_cmd,
23850 arg_data),
23851 G_DBUS_CALL_FLAGS_NONE,
23852 -1,
23853 cancellable,
23854 error);
23855 if (_ret == NULL)
23856 goto _out;
23857 g_variant_get (_ret,
23858 "(x)",
23859 out_unnamed_arg4);
23860 g_variant_unref (_ret);
23861_out:
23862 return _ret != NULL;
23863}
23864
23865/**
23866 * host_ipmi_complete_send_message:
23867 * @object: A #HostIpmi.
23868 * @invocation: (transfer full): A #GDBusMethodInvocation.
23869 * @unnamed_arg4: Parameter to return.
23870 *
23871 * 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.
23872 *
23873 * This method will free @invocation, you cannot use it afterwards.
23874 */
23875void
23876host_ipmi_complete_send_message (
23877 HostIpmi *object,
23878 GDBusMethodInvocation *invocation,
23879 gint64 unnamed_arg4)
23880{
23881 g_dbus_method_invocation_return_value (invocation,
23882 g_variant_new ("(x)",
23883 unnamed_arg4));
23884}
23885
23886/* ------------------------------------------------------------------------ */
23887
23888/**
23889 * HostIpmiProxy:
23890 *
23891 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
23892 */
23893
23894/**
23895 * HostIpmiProxyClass:
23896 * @parent_class: The parent class.
23897 *
23898 * Class structure for #HostIpmiProxy.
23899 */
23900
23901struct _HostIpmiProxyPrivate
23902{
23903 GData *qdata;
23904};
23905
23906static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
23907
23908#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23909G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
23910 G_ADD_PRIVATE (HostIpmiProxy)
23911 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
23912
23913#else
23914G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
23915 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
23916
23917#endif
23918static void
23919host_ipmi_proxy_finalize (GObject *object)
23920{
23921 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
23922 g_datalist_clear (&proxy->priv->qdata);
23923 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
23924}
23925
23926static void
23927host_ipmi_proxy_get_property (GObject *object,
23928 guint prop_id,
23929 GValue *value,
23930 GParamSpec *pspec G_GNUC_UNUSED)
23931{
23932}
23933
23934static void
23935host_ipmi_proxy_set_property (GObject *object,
23936 guint prop_id,
23937 const GValue *value,
23938 GParamSpec *pspec G_GNUC_UNUSED)
23939{
23940}
23941
23942static void
23943host_ipmi_proxy_g_signal (GDBusProxy *proxy,
23944 const gchar *sender_name G_GNUC_UNUSED,
23945 const gchar *signal_name,
23946 GVariant *parameters)
23947{
23948 _ExtendedGDBusSignalInfo *info;
23949 GVariantIter iter;
23950 GVariant *child;
23951 GValue *paramv;
23952 guint num_params;
23953 guint n;
23954 guint signal_id;
23955 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
23956 if (info == NULL)
23957 return;
23958 num_params = g_variant_n_children (parameters);
23959 paramv = g_new0 (GValue, num_params + 1);
23960 g_value_init (&paramv[0], TYPE_HOST_IPMI);
23961 g_value_set_object (&paramv[0], proxy);
23962 g_variant_iter_init (&iter, parameters);
23963 n = 1;
23964 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23965 {
23966 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23967 if (arg_info->use_gvariant)
23968 {
23969 g_value_init (&paramv[n], G_TYPE_VARIANT);
23970 g_value_set_variant (&paramv[n], child);
23971 n++;
23972 }
23973 else
23974 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23975 g_variant_unref (child);
23976 }
23977 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
23978 g_signal_emitv (paramv, signal_id, 0, NULL);
23979 for (n = 0; n < num_params + 1; n++)
23980 g_value_unset (&paramv[n]);
23981 g_free (paramv);
23982}
23983
23984static void
23985host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
23986 GVariant *changed_properties,
23987 const gchar *const *invalidated_properties)
23988{
23989 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
23990 guint n;
23991 const gchar *key;
23992 GVariantIter *iter;
23993 _ExtendedGDBusPropertyInfo *info;
23994 g_variant_get (changed_properties, "a{sv}", &iter);
23995 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23996 {
23997 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
23998 g_datalist_remove_data (&proxy->priv->qdata, key);
23999 if (info != NULL)
24000 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24001 }
24002 g_variant_iter_free (iter);
24003 for (n = 0; invalidated_properties[n] != NULL; n++)
24004 {
24005 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
24006 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
24007 if (info != NULL)
24008 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24009 }
24010}
24011
24012static void
24013host_ipmi_proxy_init (HostIpmiProxy *proxy)
24014{
24015#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24016 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
24017#else
24018 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
24019#endif
24020
24021 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
24022}
24023
24024static void
24025host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
24026{
24027 GObjectClass *gobject_class;
24028 GDBusProxyClass *proxy_class;
24029
24030 gobject_class = G_OBJECT_CLASS (klass);
24031 gobject_class->finalize = host_ipmi_proxy_finalize;
24032 gobject_class->get_property = host_ipmi_proxy_get_property;
24033 gobject_class->set_property = host_ipmi_proxy_set_property;
24034
24035 proxy_class = G_DBUS_PROXY_CLASS (klass);
24036 proxy_class->g_signal = host_ipmi_proxy_g_signal;
24037 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
24038
24039#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24040 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
24041#endif
24042}
24043
24044static void
24045host_ipmi_proxy_iface_init (HostIpmiIface *iface)
24046{
24047}
24048
24049/**
24050 * host_ipmi_proxy_new:
24051 * @connection: A #GDBusConnection.
24052 * @flags: Flags from the #GDBusProxyFlags enumeration.
24053 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24054 * @object_path: An object path.
24055 * @cancellable: (allow-none): A #GCancellable or %NULL.
24056 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24057 * @user_data: User data to pass to @callback.
24058 *
24059 * 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.
24060 *
24061 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24062 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
24063 *
24064 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
24065 */
24066void
24067host_ipmi_proxy_new (
24068 GDBusConnection *connection,
24069 GDBusProxyFlags flags,
24070 const gchar *name,
24071 const gchar *object_path,
24072 GCancellable *cancellable,
24073 GAsyncReadyCallback callback,
24074 gpointer user_data)
24075{
24076 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);
24077}
24078
24079/**
24080 * host_ipmi_proxy_new_finish:
24081 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
24082 * @error: Return location for error or %NULL
24083 *
24084 * Finishes an operation started with host_ipmi_proxy_new().
24085 *
24086 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
24087 */
24088HostIpmi *
24089host_ipmi_proxy_new_finish (
24090 GAsyncResult *res,
24091 GError **error)
24092{
24093 GObject *ret;
24094 GObject *source_object;
24095 source_object = g_async_result_get_source_object (res);
24096 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24097 g_object_unref (source_object);
24098 if (ret != NULL)
24099 return HOST_IPMI (ret);
24100 else
24101 return NULL;
24102}
24103
24104/**
24105 * host_ipmi_proxy_new_sync:
24106 * @connection: A #GDBusConnection.
24107 * @flags: Flags from the #GDBusProxyFlags enumeration.
24108 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24109 * @object_path: An object path.
24110 * @cancellable: (allow-none): A #GCancellable or %NULL.
24111 * @error: Return location for error or %NULL
24112 *
24113 * 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.
24114 *
24115 * The calling thread is blocked until a reply is received.
24116 *
24117 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
24118 *
24119 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
24120 */
24121HostIpmi *
24122host_ipmi_proxy_new_sync (
24123 GDBusConnection *connection,
24124 GDBusProxyFlags flags,
24125 const gchar *name,
24126 const gchar *object_path,
24127 GCancellable *cancellable,
24128 GError **error)
24129{
24130 GInitable *ret;
24131 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);
24132 if (ret != NULL)
24133 return HOST_IPMI (ret);
24134 else
24135 return NULL;
24136}
24137
24138
24139/**
24140 * host_ipmi_proxy_new_for_bus:
24141 * @bus_type: A #GBusType.
24142 * @flags: Flags from the #GDBusProxyFlags enumeration.
24143 * @name: A bus name (well-known or unique).
24144 * @object_path: An object path.
24145 * @cancellable: (allow-none): A #GCancellable or %NULL.
24146 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24147 * @user_data: User data to pass to @callback.
24148 *
24149 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
24150 *
24151 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24152 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
24153 *
24154 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
24155 */
24156void
24157host_ipmi_proxy_new_for_bus (
24158 GBusType bus_type,
24159 GDBusProxyFlags flags,
24160 const gchar *name,
24161 const gchar *object_path,
24162 GCancellable *cancellable,
24163 GAsyncReadyCallback callback,
24164 gpointer user_data)
24165{
24166 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);
24167}
24168
24169/**
24170 * host_ipmi_proxy_new_for_bus_finish:
24171 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
24172 * @error: Return location for error or %NULL
24173 *
24174 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
24175 *
24176 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
24177 */
24178HostIpmi *
24179host_ipmi_proxy_new_for_bus_finish (
24180 GAsyncResult *res,
24181 GError **error)
24182{
24183 GObject *ret;
24184 GObject *source_object;
24185 source_object = g_async_result_get_source_object (res);
24186 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24187 g_object_unref (source_object);
24188 if (ret != NULL)
24189 return HOST_IPMI (ret);
24190 else
24191 return NULL;
24192}
24193
24194/**
24195 * host_ipmi_proxy_new_for_bus_sync:
24196 * @bus_type: A #GBusType.
24197 * @flags: Flags from the #GDBusProxyFlags enumeration.
24198 * @name: A bus name (well-known or unique).
24199 * @object_path: An object path.
24200 * @cancellable: (allow-none): A #GCancellable or %NULL.
24201 * @error: Return location for error or %NULL
24202 *
24203 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
24204 *
24205 * The calling thread is blocked until a reply is received.
24206 *
24207 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
24208 *
24209 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
24210 */
24211HostIpmi *
24212host_ipmi_proxy_new_for_bus_sync (
24213 GBusType bus_type,
24214 GDBusProxyFlags flags,
24215 const gchar *name,
24216 const gchar *object_path,
24217 GCancellable *cancellable,
24218 GError **error)
24219{
24220 GInitable *ret;
24221 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);
24222 if (ret != NULL)
24223 return HOST_IPMI (ret);
24224 else
24225 return NULL;
24226}
24227
24228
24229/* ------------------------------------------------------------------------ */
24230
24231/**
24232 * HostIpmiSkeleton:
24233 *
24234 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
24235 */
24236
24237/**
24238 * HostIpmiSkeletonClass:
24239 * @parent_class: The parent class.
24240 *
24241 * Class structure for #HostIpmiSkeleton.
24242 */
24243
24244struct _HostIpmiSkeletonPrivate
24245{
24246 GValue *properties;
24247 GList *changed_properties;
24248 GSource *changed_properties_idle_source;
24249 GMainContext *context;
24250 GMutex lock;
24251};
24252
24253static void
24254_host_ipmi_skeleton_handle_method_call (
24255 GDBusConnection *connection G_GNUC_UNUSED,
24256 const gchar *sender G_GNUC_UNUSED,
24257 const gchar *object_path G_GNUC_UNUSED,
24258 const gchar *interface_name,
24259 const gchar *method_name,
24260 GVariant *parameters,
24261 GDBusMethodInvocation *invocation,
24262 gpointer user_data)
24263{
24264 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
24265 _ExtendedGDBusMethodInfo *info;
24266 GVariantIter iter;
24267 GVariant *child;
24268 GValue *paramv;
24269 guint num_params;
24270 guint num_extra;
24271 guint n;
24272 guint signal_id;
24273 GValue return_value = G_VALUE_INIT;
24274 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
24275 g_assert (info != NULL);
24276 num_params = g_variant_n_children (parameters);
24277 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
24278 n = 0;
24279 g_value_init (&paramv[n], TYPE_HOST_IPMI);
24280 g_value_set_object (&paramv[n++], skeleton);
24281 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
24282 g_value_set_object (&paramv[n++], invocation);
24283 if (info->pass_fdlist)
24284 {
24285#ifdef G_OS_UNIX
24286 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
24287 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
24288#else
24289 g_assert_not_reached ();
24290#endif
24291 }
24292 g_variant_iter_init (&iter, parameters);
24293 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24294 {
24295 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
24296 if (arg_info->use_gvariant)
24297 {
24298 g_value_init (&paramv[n], G_TYPE_VARIANT);
24299 g_value_set_variant (&paramv[n], child);
24300 n++;
24301 }
24302 else
24303 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24304 g_variant_unref (child);
24305 }
24306 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
24307 g_value_init (&return_value, G_TYPE_BOOLEAN);
24308 g_signal_emitv (paramv, signal_id, 0, &return_value);
24309 if (!g_value_get_boolean (&return_value))
24310 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);
24311 g_value_unset (&return_value);
24312 for (n = 0; n < num_params + num_extra; n++)
24313 g_value_unset (&paramv[n]);
24314 g_free (paramv);
24315}
24316
24317static GVariant *
24318_host_ipmi_skeleton_handle_get_property (
24319 GDBusConnection *connection G_GNUC_UNUSED,
24320 const gchar *sender G_GNUC_UNUSED,
24321 const gchar *object_path G_GNUC_UNUSED,
24322 const gchar *interface_name G_GNUC_UNUSED,
24323 const gchar *property_name,
24324 GError **error,
24325 gpointer user_data)
24326{
24327 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
24328 GValue value = G_VALUE_INIT;
24329 GParamSpec *pspec;
24330 _ExtendedGDBusPropertyInfo *info;
24331 GVariant *ret;
24332 ret = NULL;
24333 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
24334 g_assert (info != NULL);
24335 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24336 if (pspec == NULL)
24337 {
24338 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24339 }
24340 else
24341 {
24342 g_value_init (&value, pspec->value_type);
24343 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24344 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
24345 g_value_unset (&value);
24346 }
24347 return ret;
24348}
24349
24350static gboolean
24351_host_ipmi_skeleton_handle_set_property (
24352 GDBusConnection *connection G_GNUC_UNUSED,
24353 const gchar *sender G_GNUC_UNUSED,
24354 const gchar *object_path G_GNUC_UNUSED,
24355 const gchar *interface_name G_GNUC_UNUSED,
24356 const gchar *property_name,
24357 GVariant *variant,
24358 GError **error,
24359 gpointer user_data)
24360{
24361 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
24362 GValue value = G_VALUE_INIT;
24363 GParamSpec *pspec;
24364 _ExtendedGDBusPropertyInfo *info;
24365 gboolean ret;
24366 ret = FALSE;
24367 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
24368 g_assert (info != NULL);
24369 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24370 if (pspec == NULL)
24371 {
24372 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24373 }
24374 else
24375 {
24376 if (info->use_gvariant)
24377 g_value_set_variant (&value, variant);
24378 else
24379 g_dbus_gvariant_to_gvalue (variant, &value);
24380 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24381 g_value_unset (&value);
24382 ret = TRUE;
24383 }
24384 return ret;
24385}
24386
24387static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
24388{
24389 _host_ipmi_skeleton_handle_method_call,
24390 _host_ipmi_skeleton_handle_get_property,
24391 _host_ipmi_skeleton_handle_set_property,
24392 {NULL}
24393};
24394
24395static GDBusInterfaceInfo *
24396host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24397{
24398 return host_ipmi_interface_info ();
24399}
24400
24401static GDBusInterfaceVTable *
24402host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24403{
24404 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
24405}
24406
24407static GVariant *
24408host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
24409{
24410 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
24411
24412 GVariantBuilder builder;
24413 guint n;
24414 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24415 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
24416 goto out;
24417 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
24418 {
24419 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
24420 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
24421 {
24422 GVariant *value;
24423 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);
24424 if (value != NULL)
24425 {
24426 g_variant_take_ref (value);
24427 g_variant_builder_add (&builder, "{sv}", info->name, value);
24428 g_variant_unref (value);
24429 }
24430 }
24431 }
24432out:
24433 return g_variant_builder_end (&builder);
24434}
24435
24436static void
24437host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
24438{
24439}
24440
24441static void
24442_host_ipmi_on_signal_received_message (
24443 HostIpmi *object,
24444 guchar arg_seq,
24445 guchar arg_netfn,
24446 guchar arg_cmd,
24447 const gchar *arg_data)
24448{
24449 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
24450
24451 GList *connections, *l;
24452 GVariant *signal_variant;
24453 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24454
24455 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
24456 arg_seq,
24457 arg_netfn,
24458 arg_cmd,
24459 arg_data));
24460 for (l = connections; l != NULL; l = l->next)
24461 {
24462 GDBusConnection *connection = l->data;
24463 g_dbus_connection_emit_signal (connection,
24464 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
24465 signal_variant, NULL);
24466 }
24467 g_variant_unref (signal_variant);
24468 g_list_free_full (connections, g_object_unref);
24469}
24470
24471static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
24472#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24473G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24474 G_ADD_PRIVATE (HostIpmiSkeleton)
24475 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
24476
24477#else
24478G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24479 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
24480
24481#endif
24482static void
24483host_ipmi_skeleton_finalize (GObject *object)
24484{
24485 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
24486 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24487 if (skeleton->priv->changed_properties_idle_source != NULL)
24488 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24489 g_main_context_unref (skeleton->priv->context);
24490 g_mutex_clear (&skeleton->priv->lock);
24491 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
24492}
24493
24494static void
24495host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
24496{
24497#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24498 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
24499#else
24500 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
24501#endif
24502
24503 g_mutex_init (&skeleton->priv->lock);
24504 skeleton->priv->context = g_main_context_ref_thread_default ();
24505}
24506
24507static void
24508host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
24509{
24510 GObjectClass *gobject_class;
24511 GDBusInterfaceSkeletonClass *skeleton_class;
24512
24513 gobject_class = G_OBJECT_CLASS (klass);
24514 gobject_class->finalize = host_ipmi_skeleton_finalize;
24515
24516 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
24517 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
24518 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
24519 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
24520 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
24521
24522#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24523 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
24524#endif
24525}
24526
24527static void
24528host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
24529{
24530 iface->received_message = _host_ipmi_on_signal_received_message;
24531}
24532
24533/**
24534 * host_ipmi_skeleton_new:
24535 *
24536 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
24537 *
24538 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
24539 */
24540HostIpmi *
24541host_ipmi_skeleton_new (void)
24542{
24543 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
24544}
24545
24546/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050024547 * Code for Object, ObjectProxy and ObjectSkeleton
24548 * ------------------------------------------------------------------------
24549 */
24550
24551/**
24552 * SECTION:Object
24553 * @title: Object
24554 * @short_description: Specialized GDBusObject types
24555 *
24556 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
24557 */
24558
24559/**
24560 * Object:
24561 *
24562 * The #Object type is a specialized container of interfaces.
24563 */
24564
24565/**
24566 * ObjectIface:
24567 * @parent_iface: The parent interface.
24568 *
24569 * Virtual table for the #Object interface.
24570 */
24571
24572typedef ObjectIface ObjectInterface;
24573G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
24574
24575static void
24576object_default_init (ObjectIface *iface)
24577{
24578 /**
24579 * Object:occ:
24580 *
24581 * 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.
24582 *
24583 * Connect to the #GObject::notify signal to get informed of property changes.
24584 */
24585 g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24586
24587 /**
24588 * Object:fan:
24589 *
24590 * 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.
24591 *
24592 * Connect to the #GObject::notify signal to get informed of property changes.
24593 */
24594 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24595
24596 /**
24597 * Object:sensor-value:
24598 *
24599 * 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.
24600 *
24601 * Connect to the #GObject::notify signal to get informed of property changes.
24602 */
24603 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));
24604
24605 /**
24606 * Object:sensor-threshold:
24607 *
24608 * 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.
24609 *
24610 * Connect to the #GObject::notify signal to get informed of property changes.
24611 */
24612 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));
24613
24614 /**
24615 * Object:sensor-i2c:
24616 *
24617 * 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.
24618 *
24619 * Connect to the #GObject::notify signal to get informed of property changes.
24620 */
24621 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));
24622
24623 /**
24624 * Object:sensor-match:
24625 *
24626 * 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.
24627 *
24628 * Connect to the #GObject::notify signal to get informed of property changes.
24629 */
24630 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));
24631
24632 /**
24633 * Object:process:
24634 *
24635 * 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.
24636 *
24637 * Connect to the #GObject::notify signal to get informed of property changes.
24638 */
24639 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24640
24641 /**
24642 * Object:control:
24643 *
24644 * 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.
24645 *
24646 * Connect to the #GObject::notify signal to get informed of property changes.
24647 */
24648 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24649
24650 /**
24651 * Object:control-bmc:
24652 *
24653 * 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.
24654 *
24655 * Connect to the #GObject::notify signal to get informed of property changes.
24656 */
24657 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));
24658
24659 /**
24660 * Object:control-host:
24661 *
24662 * 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.
24663 *
24664 * Connect to the #GObject::notify signal to get informed of property changes.
24665 */
24666 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));
24667
24668 /**
24669 * Object:control-power:
24670 *
24671 * 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.
24672 *
24673 * Connect to the #GObject::notify signal to get informed of property changes.
24674 */
24675 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));
24676
24677 /**
24678 * Object:watchdog:
24679 *
24680 * 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.
24681 *
24682 * Connect to the #GObject::notify signal to get informed of property changes.
24683 */
24684 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24685
24686 /**
24687 * Object:event-log:
24688 *
24689 * 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.
24690 *
24691 * Connect to the #GObject::notify signal to get informed of property changes.
24692 */
24693 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));
24694
24695 /**
24696 * Object:flash:
24697 *
24698 * 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.
24699 *
24700 * Connect to the #GObject::notify signal to get informed of property changes.
24701 */
24702 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24703
24704 /**
24705 * Object:button:
24706 *
24707 * 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.
24708 *
24709 * Connect to the #GObject::notify signal to get informed of property changes.
24710 */
24711 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24712
24713 /**
24714 * Object:led:
24715 *
24716 * 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.
24717 *
24718 * Connect to the #GObject::notify signal to get informed of property changes.
24719 */
24720 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24721
Norman Jamesdbcffbd2015-10-06 16:53:06 -050024722 /**
24723 * Object:host-ipmi:
24724 *
24725 * 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.
24726 *
24727 * Connect to the #GObject::notify signal to get informed of property changes.
24728 */
24729 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));
24730
Norman James362a80f2015-09-14 14:04:39 -050024731}
24732
24733/**
24734 * object_get_occ:
24735 * @object: A #Object.
24736 *
24737 * 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.
24738 *
24739 * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24740 */
24741Occ *object_get_occ (Object *object)
24742{
24743 GDBusInterface *ret;
24744 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24745 if (ret == NULL)
24746 return NULL;
24747 return OCC (ret);
24748}
24749
24750/**
24751 * object_get_fan:
24752 * @object: A #Object.
24753 *
24754 * 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.
24755 *
24756 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24757 */
24758Fan *object_get_fan (Object *object)
24759{
24760 GDBusInterface *ret;
24761 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24762 if (ret == NULL)
24763 return NULL;
24764 return FAN (ret);
24765}
24766
24767/**
24768 * object_get_sensor_value:
24769 * @object: A #Object.
24770 *
24771 * 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.
24772 *
24773 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24774 */
24775SensorValue *object_get_sensor_value (Object *object)
24776{
24777 GDBusInterface *ret;
24778 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24779 if (ret == NULL)
24780 return NULL;
24781 return SENSOR_VALUE (ret);
24782}
24783
24784/**
24785 * object_get_sensor_threshold:
24786 * @object: A #Object.
24787 *
24788 * 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.
24789 *
24790 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24791 */
24792SensorThreshold *object_get_sensor_threshold (Object *object)
24793{
24794 GDBusInterface *ret;
24795 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24796 if (ret == NULL)
24797 return NULL;
24798 return SENSOR_THRESHOLD (ret);
24799}
24800
24801/**
24802 * object_get_sensor_i2c:
24803 * @object: A #Object.
24804 *
24805 * 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.
24806 *
24807 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24808 */
24809SensorI2c *object_get_sensor_i2c (Object *object)
24810{
24811 GDBusInterface *ret;
24812 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24813 if (ret == NULL)
24814 return NULL;
24815 return SENSOR_I2C (ret);
24816}
24817
24818/**
24819 * object_get_sensor_match:
24820 * @object: A #Object.
24821 *
24822 * 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.
24823 *
24824 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24825 */
24826SensorMatch *object_get_sensor_match (Object *object)
24827{
24828 GDBusInterface *ret;
24829 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24830 if (ret == NULL)
24831 return NULL;
24832 return SENSOR_MATCH (ret);
24833}
24834
24835/**
24836 * object_get_process:
24837 * @object: A #Object.
24838 *
24839 * 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.
24840 *
24841 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24842 */
24843Process *object_get_process (Object *object)
24844{
24845 GDBusInterface *ret;
24846 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24847 if (ret == NULL)
24848 return NULL;
24849 return PROCESS (ret);
24850}
24851
24852/**
24853 * object_get_control:
24854 * @object: A #Object.
24855 *
24856 * 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.
24857 *
24858 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24859 */
24860Control *object_get_control (Object *object)
24861{
24862 GDBusInterface *ret;
24863 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24864 if (ret == NULL)
24865 return NULL;
24866 return CONTROL (ret);
24867}
24868
24869/**
24870 * object_get_control_bmc:
24871 * @object: A #Object.
24872 *
24873 * 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.
24874 *
24875 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24876 */
24877ControlBmc *object_get_control_bmc (Object *object)
24878{
24879 GDBusInterface *ret;
24880 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24881 if (ret == NULL)
24882 return NULL;
24883 return CONTROL_BMC (ret);
24884}
24885
24886/**
24887 * object_get_control_host:
24888 * @object: A #Object.
24889 *
24890 * 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.
24891 *
24892 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24893 */
24894ControlHost *object_get_control_host (Object *object)
24895{
24896 GDBusInterface *ret;
24897 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24898 if (ret == NULL)
24899 return NULL;
24900 return CONTROL_HOST (ret);
24901}
24902
24903/**
24904 * object_get_control_power:
24905 * @object: A #Object.
24906 *
24907 * 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.
24908 *
24909 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24910 */
24911ControlPower *object_get_control_power (Object *object)
24912{
24913 GDBusInterface *ret;
24914 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24915 if (ret == NULL)
24916 return NULL;
24917 return CONTROL_POWER (ret);
24918}
24919
24920/**
24921 * object_get_watchdog:
24922 * @object: A #Object.
24923 *
24924 * 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.
24925 *
24926 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24927 */
24928Watchdog *object_get_watchdog (Object *object)
24929{
24930 GDBusInterface *ret;
24931 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24932 if (ret == NULL)
24933 return NULL;
24934 return WATCHDOG (ret);
24935}
24936
24937/**
24938 * object_get_event_log:
24939 * @object: A #Object.
24940 *
24941 * 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.
24942 *
24943 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24944 */
24945EventLog *object_get_event_log (Object *object)
24946{
24947 GDBusInterface *ret;
24948 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24949 if (ret == NULL)
24950 return NULL;
24951 return EVENT_LOG (ret);
24952}
24953
24954/**
24955 * object_get_flash:
24956 * @object: A #Object.
24957 *
24958 * 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.
24959 *
24960 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24961 */
24962Flash *object_get_flash (Object *object)
24963{
24964 GDBusInterface *ret;
24965 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24966 if (ret == NULL)
24967 return NULL;
24968 return FLASH (ret);
24969}
24970
24971/**
24972 * object_get_button:
24973 * @object: A #Object.
24974 *
24975 * 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.
24976 *
24977 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24978 */
24979Button *object_get_button (Object *object)
24980{
24981 GDBusInterface *ret;
24982 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24983 if (ret == NULL)
24984 return NULL;
24985 return BUTTON (ret);
24986}
24987
24988/**
24989 * object_get_led:
24990 * @object: A #Object.
24991 *
24992 * 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.
24993 *
24994 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24995 */
24996Led *object_get_led (Object *object)
24997{
24998 GDBusInterface *ret;
24999 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25000 if (ret == NULL)
25001 return NULL;
25002 return LED (ret);
25003}
25004
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025005/**
25006 * object_get_host_ipmi:
25007 * @object: A #Object.
25008 *
25009 * 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.
25010 *
25011 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
25012 */
25013HostIpmi *object_get_host_ipmi (Object *object)
25014{
25015 GDBusInterface *ret;
25016 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
25017 if (ret == NULL)
25018 return NULL;
25019 return HOST_IPMI (ret);
25020}
25021
Norman James362a80f2015-09-14 14:04:39 -050025022
25023/**
25024 * object_peek_occ: (skip)
25025 * @object: A #Object.
25026 *
25027 * Like object_get_occ() but doesn't increase the reference count on the returned object.
25028 *
25029 * <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>
25030 *
25031 * 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.
25032 */
25033Occ *object_peek_occ (Object *object)
25034{
25035 GDBusInterface *ret;
25036 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
25037 if (ret == NULL)
25038 return NULL;
25039 g_object_unref (ret);
25040 return OCC (ret);
25041}
25042
25043/**
25044 * object_peek_fan: (skip)
25045 * @object: A #Object.
25046 *
25047 * Like object_get_fan() but doesn't increase the reference count on the returned object.
25048 *
25049 * <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>
25050 *
25051 * 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.
25052 */
25053Fan *object_peek_fan (Object *object)
25054{
25055 GDBusInterface *ret;
25056 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
25057 if (ret == NULL)
25058 return NULL;
25059 g_object_unref (ret);
25060 return FAN (ret);
25061}
25062
25063/**
25064 * object_peek_sensor_value: (skip)
25065 * @object: A #Object.
25066 *
25067 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
25068 *
25069 * <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>
25070 *
25071 * 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.
25072 */
25073SensorValue *object_peek_sensor_value (Object *object)
25074{
25075 GDBusInterface *ret;
25076 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
25077 if (ret == NULL)
25078 return NULL;
25079 g_object_unref (ret);
25080 return SENSOR_VALUE (ret);
25081}
25082
25083/**
25084 * object_peek_sensor_threshold: (skip)
25085 * @object: A #Object.
25086 *
25087 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
25088 *
25089 * <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>
25090 *
25091 * 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.
25092 */
25093SensorThreshold *object_peek_sensor_threshold (Object *object)
25094{
25095 GDBusInterface *ret;
25096 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
25097 if (ret == NULL)
25098 return NULL;
25099 g_object_unref (ret);
25100 return SENSOR_THRESHOLD (ret);
25101}
25102
25103/**
25104 * object_peek_sensor_i2c: (skip)
25105 * @object: A #Object.
25106 *
25107 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
25108 *
25109 * <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>
25110 *
25111 * 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.
25112 */
25113SensorI2c *object_peek_sensor_i2c (Object *object)
25114{
25115 GDBusInterface *ret;
25116 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
25117 if (ret == NULL)
25118 return NULL;
25119 g_object_unref (ret);
25120 return SENSOR_I2C (ret);
25121}
25122
25123/**
25124 * object_peek_sensor_match: (skip)
25125 * @object: A #Object.
25126 *
25127 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
25128 *
25129 * <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>
25130 *
25131 * 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.
25132 */
25133SensorMatch *object_peek_sensor_match (Object *object)
25134{
25135 GDBusInterface *ret;
25136 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
25137 if (ret == NULL)
25138 return NULL;
25139 g_object_unref (ret);
25140 return SENSOR_MATCH (ret);
25141}
25142
25143/**
25144 * object_peek_process: (skip)
25145 * @object: A #Object.
25146 *
25147 * Like object_get_process() but doesn't increase the reference count on the returned object.
25148 *
25149 * <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>
25150 *
25151 * 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.
25152 */
25153Process *object_peek_process (Object *object)
25154{
25155 GDBusInterface *ret;
25156 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
25157 if (ret == NULL)
25158 return NULL;
25159 g_object_unref (ret);
25160 return PROCESS (ret);
25161}
25162
25163/**
25164 * object_peek_control: (skip)
25165 * @object: A #Object.
25166 *
25167 * Like object_get_control() but doesn't increase the reference count on the returned object.
25168 *
25169 * <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>
25170 *
25171 * 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.
25172 */
25173Control *object_peek_control (Object *object)
25174{
25175 GDBusInterface *ret;
25176 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
25177 if (ret == NULL)
25178 return NULL;
25179 g_object_unref (ret);
25180 return CONTROL (ret);
25181}
25182
25183/**
25184 * object_peek_control_bmc: (skip)
25185 * @object: A #Object.
25186 *
25187 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
25188 *
25189 * <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>
25190 *
25191 * 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.
25192 */
25193ControlBmc *object_peek_control_bmc (Object *object)
25194{
25195 GDBusInterface *ret;
25196 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
25197 if (ret == NULL)
25198 return NULL;
25199 g_object_unref (ret);
25200 return CONTROL_BMC (ret);
25201}
25202
25203/**
25204 * object_peek_control_host: (skip)
25205 * @object: A #Object.
25206 *
25207 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
25208 *
25209 * <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>
25210 *
25211 * 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.
25212 */
25213ControlHost *object_peek_control_host (Object *object)
25214{
25215 GDBusInterface *ret;
25216 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
25217 if (ret == NULL)
25218 return NULL;
25219 g_object_unref (ret);
25220 return CONTROL_HOST (ret);
25221}
25222
25223/**
25224 * object_peek_control_power: (skip)
25225 * @object: A #Object.
25226 *
25227 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
25228 *
25229 * <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>
25230 *
25231 * 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.
25232 */
25233ControlPower *object_peek_control_power (Object *object)
25234{
25235 GDBusInterface *ret;
25236 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
25237 if (ret == NULL)
25238 return NULL;
25239 g_object_unref (ret);
25240 return CONTROL_POWER (ret);
25241}
25242
25243/**
25244 * object_peek_watchdog: (skip)
25245 * @object: A #Object.
25246 *
25247 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
25248 *
25249 * <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>
25250 *
25251 * 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.
25252 */
25253Watchdog *object_peek_watchdog (Object *object)
25254{
25255 GDBusInterface *ret;
25256 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
25257 if (ret == NULL)
25258 return NULL;
25259 g_object_unref (ret);
25260 return WATCHDOG (ret);
25261}
25262
25263/**
25264 * object_peek_event_log: (skip)
25265 * @object: A #Object.
25266 *
25267 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
25268 *
25269 * <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>
25270 *
25271 * 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.
25272 */
25273EventLog *object_peek_event_log (Object *object)
25274{
25275 GDBusInterface *ret;
25276 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
25277 if (ret == NULL)
25278 return NULL;
25279 g_object_unref (ret);
25280 return EVENT_LOG (ret);
25281}
25282
25283/**
25284 * object_peek_flash: (skip)
25285 * @object: A #Object.
25286 *
25287 * Like object_get_flash() but doesn't increase the reference count on the returned object.
25288 *
25289 * <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>
25290 *
25291 * 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.
25292 */
25293Flash *object_peek_flash (Object *object)
25294{
25295 GDBusInterface *ret;
25296 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
25297 if (ret == NULL)
25298 return NULL;
25299 g_object_unref (ret);
25300 return FLASH (ret);
25301}
25302
25303/**
25304 * object_peek_button: (skip)
25305 * @object: A #Object.
25306 *
25307 * Like object_get_button() but doesn't increase the reference count on the returned object.
25308 *
25309 * <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>
25310 *
25311 * 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.
25312 */
25313Button *object_peek_button (Object *object)
25314{
25315 GDBusInterface *ret;
25316 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25317 if (ret == NULL)
25318 return NULL;
25319 g_object_unref (ret);
25320 return BUTTON (ret);
25321}
25322
25323/**
25324 * object_peek_led: (skip)
25325 * @object: A #Object.
25326 *
25327 * Like object_get_led() but doesn't increase the reference count on the returned object.
25328 *
25329 * <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>
25330 *
25331 * 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.
25332 */
25333Led *object_peek_led (Object *object)
25334{
25335 GDBusInterface *ret;
25336 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25337 if (ret == NULL)
25338 return NULL;
25339 g_object_unref (ret);
25340 return LED (ret);
25341}
25342
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025343/**
25344 * object_peek_host_ipmi: (skip)
25345 * @object: A #Object.
25346 *
25347 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
25348 *
25349 * <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>
25350 *
25351 * 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.
25352 */
25353HostIpmi *object_peek_host_ipmi (Object *object)
25354{
25355 GDBusInterface *ret;
25356 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
25357 if (ret == NULL)
25358 return NULL;
25359 g_object_unref (ret);
25360 return HOST_IPMI (ret);
25361}
25362
Norman James362a80f2015-09-14 14:04:39 -050025363
25364static void
25365object_notify (GDBusObject *object, GDBusInterface *interface)
25366{
25367 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
25368 /* info can be NULL if the other end is using a D-Bus interface we don't know
25369 * anything about, for example old generated code in this process talking to
25370 * newer generated code in the other process. */
25371 if (info != NULL)
25372 g_object_notify (G_OBJECT (object), info->hyphen_name);
25373}
25374
25375/**
25376 * ObjectProxy:
25377 *
25378 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
25379 */
25380
25381/**
25382 * ObjectProxyClass:
25383 * @parent_class: The parent class.
25384 *
25385 * Class structure for #ObjectProxy.
25386 */
25387
25388static void
25389object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
25390{
25391}
25392
25393static void
25394object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
25395{
25396 iface->interface_added = object_notify;
25397 iface->interface_removed = object_notify;
25398}
25399
25400
25401G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
25402 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
25403 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
25404
25405static void
25406object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
25407{
25408}
25409
25410static void
25411object_proxy_set_property (GObject *gobject,
25412 guint prop_id,
25413 const GValue *value G_GNUC_UNUSED,
25414 GParamSpec *pspec)
25415{
25416 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25417}
25418
25419static void
25420object_proxy_get_property (GObject *gobject,
25421 guint prop_id,
25422 GValue *value,
25423 GParamSpec *pspec)
25424{
25425 ObjectProxy *object = OBJECT_PROXY (gobject);
25426 GDBusInterface *interface;
25427
25428 switch (prop_id)
25429 {
25430 case 1:
25431 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
25432 g_value_take_object (value, interface);
25433 break;
25434
25435 case 2:
25436 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
25437 g_value_take_object (value, interface);
25438 break;
25439
25440 case 3:
25441 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
25442 g_value_take_object (value, interface);
25443 break;
25444
25445 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025446 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050025447 g_value_take_object (value, interface);
25448 break;
25449
Norman James19e45912015-10-04 20:19:41 -050025450 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025451 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050025452 g_value_take_object (value, interface);
25453 break;
25454
Norman James19e45912015-10-04 20:19:41 -050025455 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025456 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050025457 g_value_take_object (value, interface);
25458 break;
25459
Norman James19e45912015-10-04 20:19:41 -050025460 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025461 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050025462 g_value_take_object (value, interface);
25463 break;
25464
Norman James19e45912015-10-04 20:19:41 -050025465 case 8:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025466 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050025467 g_value_take_object (value, interface);
25468 break;
25469
Norman James19e45912015-10-04 20:19:41 -050025470 case 9:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025471 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050025472 g_value_take_object (value, interface);
25473 break;
25474
Norman James19e45912015-10-04 20:19:41 -050025475 case 10:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025476 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050025477 g_value_take_object (value, interface);
25478 break;
25479
Norman James19e45912015-10-04 20:19:41 -050025480 case 11:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025481 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050025482 g_value_take_object (value, interface);
25483 break;
25484
Norman James19e45912015-10-04 20:19:41 -050025485 case 12:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025486 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050025487 g_value_take_object (value, interface);
25488 break;
25489
Norman James19e45912015-10-04 20:19:41 -050025490 case 13:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025491 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050025492 g_value_take_object (value, interface);
25493 break;
25494
Norman James19e45912015-10-04 20:19:41 -050025495 case 14:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025496 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James362a80f2015-09-14 14:04:39 -050025497 g_value_take_object (value, interface);
25498 break;
25499
Norman James19e45912015-10-04 20:19:41 -050025500 case 15:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025501 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25502 g_value_take_object (value, interface);
25503 break;
25504
Norman James19e45912015-10-04 20:19:41 -050025505 case 16:
Norman James362a80f2015-09-14 14:04:39 -050025506 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25507 g_value_take_object (value, interface);
25508 break;
25509
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025510 case 17:
25511 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
25512 g_value_take_object (value, interface);
25513 break;
25514
Norman James362a80f2015-09-14 14:04:39 -050025515 default:
25516 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25517 break;
25518 }
25519}
25520
25521static void
25522object_proxy_class_init (ObjectProxyClass *klass)
25523{
25524 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
25525
25526 gobject_class->set_property = object_proxy_set_property;
25527 gobject_class->get_property = object_proxy_get_property;
25528
25529 g_object_class_override_property (gobject_class, 1, "occ");
25530 g_object_class_override_property (gobject_class, 2, "fan");
25531 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050025532 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
25533 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
25534 g_object_class_override_property (gobject_class, 6, "sensor-match");
25535 g_object_class_override_property (gobject_class, 7, "process");
25536 g_object_class_override_property (gobject_class, 8, "control");
25537 g_object_class_override_property (gobject_class, 9, "control-bmc");
25538 g_object_class_override_property (gobject_class, 10, "control-host");
25539 g_object_class_override_property (gobject_class, 11, "control-power");
25540 g_object_class_override_property (gobject_class, 12, "watchdog");
25541 g_object_class_override_property (gobject_class, 13, "event-log");
25542 g_object_class_override_property (gobject_class, 14, "flash");
25543 g_object_class_override_property (gobject_class, 15, "button");
25544 g_object_class_override_property (gobject_class, 16, "led");
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025545 g_object_class_override_property (gobject_class, 17, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050025546}
25547
25548/**
25549 * object_proxy_new:
25550 * @connection: A #GDBusConnection.
25551 * @object_path: An object path.
25552 *
25553 * Creates a new proxy object.
25554 *
25555 * Returns: (transfer full): The proxy object.
25556 */
25557ObjectProxy *
25558object_proxy_new (GDBusConnection *connection,
25559 const gchar *object_path)
25560{
25561 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
25562 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
25563 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
25564}
25565
25566/**
25567 * ObjectSkeleton:
25568 *
25569 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
25570 */
25571
25572/**
25573 * ObjectSkeletonClass:
25574 * @parent_class: The parent class.
25575 *
25576 * Class structure for #ObjectSkeleton.
25577 */
25578
25579static void
25580object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
25581{
25582}
25583
25584
25585static void
25586object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
25587{
25588 iface->interface_added = object_notify;
25589 iface->interface_removed = object_notify;
25590}
25591
25592G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
25593 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
25594 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
25595
25596static void
25597object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
25598{
25599}
25600
25601static void
25602object_skeleton_set_property (GObject *gobject,
25603 guint prop_id,
25604 const GValue *value,
25605 GParamSpec *pspec)
25606{
25607 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
25608 GDBusInterfaceSkeleton *interface;
25609
25610 switch (prop_id)
25611 {
25612 case 1:
25613 interface = g_value_get_object (value);
25614 if (interface != NULL)
25615 {
25616 g_warn_if_fail (IS_OCC (interface));
25617 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25618 }
25619 else
25620 {
25621 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
25622 }
25623 break;
25624
25625 case 2:
25626 interface = g_value_get_object (value);
25627 if (interface != NULL)
25628 {
25629 g_warn_if_fail (IS_FAN (interface));
25630 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25631 }
25632 else
25633 {
25634 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
25635 }
25636 break;
25637
25638 case 3:
25639 interface = g_value_get_object (value);
25640 if (interface != NULL)
25641 {
25642 g_warn_if_fail (IS_SENSOR_VALUE (interface));
25643 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25644 }
25645 else
25646 {
25647 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
25648 }
25649 break;
25650
25651 case 4:
25652 interface = g_value_get_object (value);
25653 if (interface != NULL)
25654 {
25655 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
25656 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25657 }
25658 else
25659 {
25660 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
25661 }
25662 break;
25663
Norman James19e45912015-10-04 20:19:41 -050025664 case 5:
Norman James362a80f2015-09-14 14:04:39 -050025665 interface = g_value_get_object (value);
25666 if (interface != NULL)
25667 {
25668 g_warn_if_fail (IS_SENSOR_I2C (interface));
25669 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25670 }
25671 else
25672 {
25673 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
25674 }
25675 break;
25676
Norman James19e45912015-10-04 20:19:41 -050025677 case 6:
Norman James362a80f2015-09-14 14:04:39 -050025678 interface = g_value_get_object (value);
25679 if (interface != NULL)
25680 {
25681 g_warn_if_fail (IS_SENSOR_MATCH (interface));
25682 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25683 }
25684 else
25685 {
25686 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
25687 }
25688 break;
25689
Norman James19e45912015-10-04 20:19:41 -050025690 case 7:
Norman James362a80f2015-09-14 14:04:39 -050025691 interface = g_value_get_object (value);
25692 if (interface != NULL)
25693 {
25694 g_warn_if_fail (IS_PROCESS (interface));
25695 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25696 }
25697 else
25698 {
25699 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
25700 }
25701 break;
25702
Norman James19e45912015-10-04 20:19:41 -050025703 case 8:
Norman James362a80f2015-09-14 14:04:39 -050025704 interface = g_value_get_object (value);
25705 if (interface != NULL)
25706 {
25707 g_warn_if_fail (IS_CONTROL (interface));
25708 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25709 }
25710 else
25711 {
25712 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
25713 }
25714 break;
25715
Norman James19e45912015-10-04 20:19:41 -050025716 case 9:
Norman James362a80f2015-09-14 14:04:39 -050025717 interface = g_value_get_object (value);
25718 if (interface != NULL)
25719 {
25720 g_warn_if_fail (IS_CONTROL_BMC (interface));
25721 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25722 }
25723 else
25724 {
25725 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
25726 }
25727 break;
25728
Norman James19e45912015-10-04 20:19:41 -050025729 case 10:
Norman James362a80f2015-09-14 14:04:39 -050025730 interface = g_value_get_object (value);
25731 if (interface != NULL)
25732 {
25733 g_warn_if_fail (IS_CONTROL_HOST (interface));
25734 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25735 }
25736 else
25737 {
25738 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
25739 }
25740 break;
25741
Norman James19e45912015-10-04 20:19:41 -050025742 case 11:
Norman James362a80f2015-09-14 14:04:39 -050025743 interface = g_value_get_object (value);
25744 if (interface != NULL)
25745 {
25746 g_warn_if_fail (IS_CONTROL_POWER (interface));
25747 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25748 }
25749 else
25750 {
25751 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
25752 }
25753 break;
25754
Norman James19e45912015-10-04 20:19:41 -050025755 case 12:
Norman James362a80f2015-09-14 14:04:39 -050025756 interface = g_value_get_object (value);
25757 if (interface != NULL)
25758 {
25759 g_warn_if_fail (IS_WATCHDOG (interface));
25760 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25761 }
25762 else
25763 {
25764 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
25765 }
25766 break;
25767
Norman James19e45912015-10-04 20:19:41 -050025768 case 13:
Norman James362a80f2015-09-14 14:04:39 -050025769 interface = g_value_get_object (value);
25770 if (interface != NULL)
25771 {
25772 g_warn_if_fail (IS_EVENT_LOG (interface));
25773 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25774 }
25775 else
25776 {
25777 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
25778 }
25779 break;
25780
Norman James19e45912015-10-04 20:19:41 -050025781 case 14:
Norman James362a80f2015-09-14 14:04:39 -050025782 interface = g_value_get_object (value);
25783 if (interface != NULL)
25784 {
25785 g_warn_if_fail (IS_FLASH (interface));
25786 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25787 }
25788 else
25789 {
25790 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
25791 }
25792 break;
25793
Norman James19e45912015-10-04 20:19:41 -050025794 case 15:
Norman James362a80f2015-09-14 14:04:39 -050025795 interface = g_value_get_object (value);
25796 if (interface != NULL)
25797 {
25798 g_warn_if_fail (IS_BUTTON (interface));
25799 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25800 }
25801 else
25802 {
25803 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
25804 }
25805 break;
25806
Norman James19e45912015-10-04 20:19:41 -050025807 case 16:
Norman James362a80f2015-09-14 14:04:39 -050025808 interface = g_value_get_object (value);
25809 if (interface != NULL)
25810 {
25811 g_warn_if_fail (IS_LED (interface));
25812 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25813 }
25814 else
25815 {
25816 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
25817 }
25818 break;
25819
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025820 case 17:
25821 interface = g_value_get_object (value);
25822 if (interface != NULL)
25823 {
25824 g_warn_if_fail (IS_HOST_IPMI (interface));
25825 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25826 }
25827 else
25828 {
25829 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
25830 }
25831 break;
25832
Norman James362a80f2015-09-14 14:04:39 -050025833 default:
25834 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25835 break;
25836 }
25837}
25838
25839static void
25840object_skeleton_get_property (GObject *gobject,
25841 guint prop_id,
25842 GValue *value,
25843 GParamSpec *pspec)
25844{
25845 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
25846 GDBusInterface *interface;
25847
25848 switch (prop_id)
25849 {
25850 case 1:
25851 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
25852 g_value_take_object (value, interface);
25853 break;
25854
25855 case 2:
25856 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
25857 g_value_take_object (value, interface);
25858 break;
25859
25860 case 3:
25861 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
25862 g_value_take_object (value, interface);
25863 break;
25864
25865 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025866 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050025867 g_value_take_object (value, interface);
25868 break;
25869
Norman James19e45912015-10-04 20:19:41 -050025870 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025871 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050025872 g_value_take_object (value, interface);
25873 break;
25874
Norman James19e45912015-10-04 20:19:41 -050025875 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025876 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050025877 g_value_take_object (value, interface);
25878 break;
25879
Norman James19e45912015-10-04 20:19:41 -050025880 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025881 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050025882 g_value_take_object (value, interface);
25883 break;
25884
Norman James19e45912015-10-04 20:19:41 -050025885 case 8:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025886 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050025887 g_value_take_object (value, interface);
25888 break;
25889
Norman James19e45912015-10-04 20:19:41 -050025890 case 9:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025891 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050025892 g_value_take_object (value, interface);
25893 break;
25894
Norman James19e45912015-10-04 20:19:41 -050025895 case 10:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025896 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050025897 g_value_take_object (value, interface);
25898 break;
25899
Norman James19e45912015-10-04 20:19:41 -050025900 case 11:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025901 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050025902 g_value_take_object (value, interface);
25903 break;
25904
Norman James19e45912015-10-04 20:19:41 -050025905 case 12:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025906 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050025907 g_value_take_object (value, interface);
25908 break;
25909
Norman James19e45912015-10-04 20:19:41 -050025910 case 13:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025911 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050025912 g_value_take_object (value, interface);
25913 break;
25914
Norman James19e45912015-10-04 20:19:41 -050025915 case 14:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025916 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James362a80f2015-09-14 14:04:39 -050025917 g_value_take_object (value, interface);
25918 break;
25919
Norman James19e45912015-10-04 20:19:41 -050025920 case 15:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025921 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25922 g_value_take_object (value, interface);
25923 break;
25924
Norman James19e45912015-10-04 20:19:41 -050025925 case 16:
Norman James362a80f2015-09-14 14:04:39 -050025926 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25927 g_value_take_object (value, interface);
25928 break;
25929
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025930 case 17:
25931 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
25932 g_value_take_object (value, interface);
25933 break;
25934
Norman James362a80f2015-09-14 14:04:39 -050025935 default:
25936 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25937 break;
25938 }
25939}
25940
25941static void
25942object_skeleton_class_init (ObjectSkeletonClass *klass)
25943{
25944 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
25945
25946 gobject_class->set_property = object_skeleton_set_property;
25947 gobject_class->get_property = object_skeleton_get_property;
25948
25949 g_object_class_override_property (gobject_class, 1, "occ");
25950 g_object_class_override_property (gobject_class, 2, "fan");
25951 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050025952 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
25953 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
25954 g_object_class_override_property (gobject_class, 6, "sensor-match");
25955 g_object_class_override_property (gobject_class, 7, "process");
25956 g_object_class_override_property (gobject_class, 8, "control");
25957 g_object_class_override_property (gobject_class, 9, "control-bmc");
25958 g_object_class_override_property (gobject_class, 10, "control-host");
25959 g_object_class_override_property (gobject_class, 11, "control-power");
25960 g_object_class_override_property (gobject_class, 12, "watchdog");
25961 g_object_class_override_property (gobject_class, 13, "event-log");
25962 g_object_class_override_property (gobject_class, 14, "flash");
25963 g_object_class_override_property (gobject_class, 15, "button");
25964 g_object_class_override_property (gobject_class, 16, "led");
Norman Jamesdbcffbd2015-10-06 16:53:06 -050025965 g_object_class_override_property (gobject_class, 17, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050025966}
25967
25968/**
25969 * object_skeleton_new:
25970 * @object_path: An object path.
25971 *
25972 * Creates a new skeleton object.
25973 *
25974 * Returns: (transfer full): The skeleton object.
25975 */
25976ObjectSkeleton *
25977object_skeleton_new (const gchar *object_path)
25978{
25979 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
25980 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
25981}
25982
25983/**
25984 * object_skeleton_set_occ:
25985 * @object: A #ObjectSkeleton.
25986 * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
25987 *
25988 * 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.
25989 */
25990void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
25991{
25992 g_object_set (G_OBJECT (object), "occ", interface_, NULL);
25993}
25994
25995/**
25996 * object_skeleton_set_fan:
25997 * @object: A #ObjectSkeleton.
25998 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
25999 *
26000 * 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.
26001 */
26002void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
26003{
26004 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
26005}
26006
26007/**
26008 * object_skeleton_set_sensor_value:
26009 * @object: A #ObjectSkeleton.
26010 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
26011 *
26012 * 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.
26013 */
26014void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
26015{
26016 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
26017}
26018
26019/**
26020 * object_skeleton_set_sensor_threshold:
26021 * @object: A #ObjectSkeleton.
26022 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
26023 *
26024 * 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.
26025 */
26026void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
26027{
26028 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
26029}
26030
26031/**
26032 * object_skeleton_set_sensor_i2c:
26033 * @object: A #ObjectSkeleton.
26034 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
26035 *
26036 * 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.
26037 */
26038void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
26039{
26040 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
26041}
26042
26043/**
26044 * object_skeleton_set_sensor_match:
26045 * @object: A #ObjectSkeleton.
26046 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
26047 *
26048 * 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.
26049 */
26050void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
26051{
26052 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
26053}
26054
26055/**
26056 * object_skeleton_set_process:
26057 * @object: A #ObjectSkeleton.
26058 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
26059 *
26060 * 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.
26061 */
26062void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
26063{
26064 g_object_set (G_OBJECT (object), "process", interface_, NULL);
26065}
26066
26067/**
26068 * object_skeleton_set_control:
26069 * @object: A #ObjectSkeleton.
26070 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
26071 *
26072 * 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.
26073 */
26074void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
26075{
26076 g_object_set (G_OBJECT (object), "control", interface_, NULL);
26077}
26078
26079/**
26080 * object_skeleton_set_control_bmc:
26081 * @object: A #ObjectSkeleton.
26082 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
26083 *
26084 * 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.
26085 */
26086void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
26087{
26088 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
26089}
26090
26091/**
26092 * object_skeleton_set_control_host:
26093 * @object: A #ObjectSkeleton.
26094 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
26095 *
26096 * 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.
26097 */
26098void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
26099{
26100 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
26101}
26102
26103/**
26104 * object_skeleton_set_control_power:
26105 * @object: A #ObjectSkeleton.
26106 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
26107 *
26108 * 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.
26109 */
26110void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
26111{
26112 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
26113}
26114
26115/**
26116 * object_skeleton_set_watchdog:
26117 * @object: A #ObjectSkeleton.
26118 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
26119 *
26120 * 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.
26121 */
26122void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
26123{
26124 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
26125}
26126
26127/**
26128 * object_skeleton_set_event_log:
26129 * @object: A #ObjectSkeleton.
26130 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
26131 *
26132 * 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.
26133 */
26134void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
26135{
26136 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
26137}
26138
26139/**
26140 * object_skeleton_set_flash:
26141 * @object: A #ObjectSkeleton.
26142 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
26143 *
26144 * 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.
26145 */
26146void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
26147{
26148 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
26149}
26150
26151/**
26152 * object_skeleton_set_button:
26153 * @object: A #ObjectSkeleton.
26154 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
26155 *
26156 * 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.
26157 */
26158void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
26159{
26160 g_object_set (G_OBJECT (object), "button", interface_, NULL);
26161}
26162
26163/**
26164 * object_skeleton_set_led:
26165 * @object: A #ObjectSkeleton.
26166 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
26167 *
26168 * 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.
26169 */
26170void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
26171{
26172 g_object_set (G_OBJECT (object), "led", interface_, NULL);
26173}
26174
Norman Jamesdbcffbd2015-10-06 16:53:06 -050026175/**
26176 * object_skeleton_set_host_ipmi:
26177 * @object: A #ObjectSkeleton.
26178 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
26179 *
26180 * 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.
26181 */
26182void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
26183{
26184 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
26185}
26186
Norman James362a80f2015-09-14 14:04:39 -050026187
26188/* ------------------------------------------------------------------------
26189 * Code for ObjectManager client
26190 * ------------------------------------------------------------------------
26191 */
26192
26193/**
26194 * SECTION:ObjectManagerClient
26195 * @title: ObjectManagerClient
26196 * @short_description: Generated GDBusObjectManagerClient type
26197 *
26198 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
26199 */
26200
26201/**
26202 * ObjectManagerClient:
26203 *
26204 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
26205 */
26206
26207/**
26208 * ObjectManagerClientClass:
26209 * @parent_class: The parent class.
26210 *
26211 * Class structure for #ObjectManagerClient.
26212 */
26213
26214G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
26215
26216static void
26217object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
26218{
26219}
26220
26221static void
26222object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
26223{
26224}
26225
26226/**
26227 * object_manager_client_get_proxy_type:
26228 * @manager: A #GDBusObjectManagerClient.
26229 * @object_path: The object path of the remote object (unused).
26230 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
26231 * @user_data: User data (unused).
26232 *
26233 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
26234 *
26235 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
26236 */
26237GType
26238object_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)
26239{
26240 static gsize once_init_value = 0;
26241 static GHashTable *lookup_hash;
26242 GType ret;
26243
26244 if (interface_name == NULL)
26245 return TYPE_OBJECT_PROXY;
26246 if (g_once_init_enter (&once_init_value))
26247 {
26248 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
26249 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
26250 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
26251 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050026252 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
26253 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
26254 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
26255 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
26256 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
26257 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
26258 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
26259 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
26260 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
26261 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
26262 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
26263 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
26264 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050026265 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050026266 g_once_init_leave (&once_init_value, 1);
26267 }
26268 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
26269 if (ret == (GType) 0)
26270 ret = G_TYPE_DBUS_PROXY;
26271 return ret;
26272}
26273
26274/**
26275 * object_manager_client_new:
26276 * @connection: A #GDBusConnection.
26277 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26278 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26279 * @object_path: An object path.
26280 * @cancellable: (allow-none): A #GCancellable or %NULL.
26281 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26282 * @user_data: User data to pass to @callback.
26283 *
26284 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
26285 *
26286 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26287 * You can then call object_manager_client_new_finish() to get the result of the operation.
26288 *
26289 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
26290 */
26291void
26292object_manager_client_new (
26293 GDBusConnection *connection,
26294 GDBusObjectManagerClientFlags flags,
26295 const gchar *name,
26296 const gchar *object_path,
26297 GCancellable *cancellable,
26298 GAsyncReadyCallback callback,
26299 gpointer user_data)
26300{
26301 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);
26302}
26303
26304/**
26305 * object_manager_client_new_finish:
26306 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
26307 * @error: Return location for error or %NULL
26308 *
26309 * Finishes an operation started with object_manager_client_new().
26310 *
26311 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26312 */
26313GDBusObjectManager *
26314object_manager_client_new_finish (
26315 GAsyncResult *res,
26316 GError **error)
26317{
26318 GObject *ret;
26319 GObject *source_object;
26320 source_object = g_async_result_get_source_object (res);
26321 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26322 g_object_unref (source_object);
26323 if (ret != NULL)
26324 return G_DBUS_OBJECT_MANAGER (ret);
26325 else
26326 return NULL;
26327}
26328
26329/**
26330 * object_manager_client_new_sync:
26331 * @connection: A #GDBusConnection.
26332 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26333 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26334 * @object_path: An object path.
26335 * @cancellable: (allow-none): A #GCancellable or %NULL.
26336 * @error: Return location for error or %NULL
26337 *
26338 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
26339 *
26340 * The calling thread is blocked until a reply is received.
26341 *
26342 * See object_manager_client_new() for the asynchronous version of this constructor.
26343 *
26344 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26345 */
26346GDBusObjectManager *
26347object_manager_client_new_sync (
26348 GDBusConnection *connection,
26349 GDBusObjectManagerClientFlags flags,
26350 const gchar *name,
26351 const gchar *object_path,
26352 GCancellable *cancellable,
26353 GError **error)
26354{
26355 GInitable *ret;
26356 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);
26357 if (ret != NULL)
26358 return G_DBUS_OBJECT_MANAGER (ret);
26359 else
26360 return NULL;
26361}
26362
26363
26364/**
26365 * object_manager_client_new_for_bus:
26366 * @bus_type: A #GBusType.
26367 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26368 * @name: A bus name (well-known or unique).
26369 * @object_path: An object path.
26370 * @cancellable: (allow-none): A #GCancellable or %NULL.
26371 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26372 * @user_data: User data to pass to @callback.
26373 *
26374 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
26375 *
26376 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26377 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
26378 *
26379 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26380 */
26381void
26382object_manager_client_new_for_bus (
26383 GBusType bus_type,
26384 GDBusObjectManagerClientFlags flags,
26385 const gchar *name,
26386 const gchar *object_path,
26387 GCancellable *cancellable,
26388 GAsyncReadyCallback callback,
26389 gpointer user_data)
26390{
26391 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);
26392}
26393
26394/**
26395 * object_manager_client_new_for_bus_finish:
26396 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
26397 * @error: Return location for error or %NULL
26398 *
26399 * Finishes an operation started with object_manager_client_new_for_bus().
26400 *
26401 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26402 */
26403GDBusObjectManager *
26404object_manager_client_new_for_bus_finish (
26405 GAsyncResult *res,
26406 GError **error)
26407{
26408 GObject *ret;
26409 GObject *source_object;
26410 source_object = g_async_result_get_source_object (res);
26411 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26412 g_object_unref (source_object);
26413 if (ret != NULL)
26414 return G_DBUS_OBJECT_MANAGER (ret);
26415 else
26416 return NULL;
26417}
26418
26419/**
26420 * object_manager_client_new_for_bus_sync:
26421 * @bus_type: A #GBusType.
26422 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26423 * @name: A bus name (well-known or unique).
26424 * @object_path: An object path.
26425 * @cancellable: (allow-none): A #GCancellable or %NULL.
26426 * @error: Return location for error or %NULL
26427 *
26428 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26429 *
26430 * The calling thread is blocked until a reply is received.
26431 *
26432 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
26433 *
26434 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26435 */
26436GDBusObjectManager *
26437object_manager_client_new_for_bus_sync (
26438 GBusType bus_type,
26439 GDBusObjectManagerClientFlags flags,
26440 const gchar *name,
26441 const gchar *object_path,
26442 GCancellable *cancellable,
26443 GError **error)
26444{
26445 GInitable *ret;
26446 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);
26447 if (ret != NULL)
26448 return G_DBUS_OBJECT_MANAGER (ret);
26449 else
26450 return NULL;
26451}
26452
26453